Created
July 8, 2019 02:19
-
-
Save igayamaguchi/ee8bf731d07776a78c10fc5cbd101ce3 to your computer and use it in GitHub Desktop.
Safariのwebkit-overflow-scrolling指定によるoverflowの挙動
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<style> | |
body { | |
font-family: -apple-system, Helvetica, Arial, sans-serif, Osaka, meiryo, MS Pゴシック; | |
margin: 0; | |
} | |
#slide-up-modal { | |
} | |
.modal-mask { | |
background-color: black; | |
position: fixed; | |
top: 0; | |
left: 0; | |
height: 100%; | |
} | |
.modal-container { | |
height: 100%; | |
} | |
.modal-body { | |
width: 100%; | |
height: 100%; | |
position: relative; | |
} | |
.close-button { | |
position: fixed; | |
top: 0; | |
left: 0; | |
color: white; | |
} | |
.contents { | |
margin-top: 40px; | |
overflow: hidden; | |
overflow-y: scroll; | |
height: 100%; | |
-webkit-overflow-scrolling: touch; | |
} | |
#open-button { | |
color: white; | |
} | |
#over-modal { | |
background: rgba(255, 196, 118, 0.82); | |
position: fixed; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="slide-up-modal"> | |
<div class="modal-mask"> | |
<div class="modal-container"> | |
<div class="modal-body"> | |
<div class="close-button">close</div> | |
<div class="contents"> | |
<div id="open-button">open</div> | |
<img src="https://www.wasaweb.net/images/stock-images/660x1188/London-38.jpg"> | |
<img src="https://www.wasaweb.net/images/stock-images/660x1188/London-38.jpg"> | |
<div id="over-modal" style="display: none;"> | |
over | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
const openButton = document.getElementById('open-button'); | |
const overModal = document.getElementById('over-modal'); | |
openButton.addEventListener('click', () => { | |
overModal.style.display = 'block'; | |
}); | |
overModal.addEventListener('click', () => { | |
overModal.style.display = 'none'; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment