A Pen by Captain Anonymous on CodePen.
Created
September 28, 2020 21:08
-
-
Save davidbwaters/3525db57f297c9d709adc3f5009068db to your computer and use it in GitHub Desktop.
Horizontal Website
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
<main style="overflow: scroll hidden;"> | |
<div class="wrapper" > | |
<div style="background-color:red"></div> | |
<div style="background-color:blue"></div> | |
</div> | |
</main> |
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
var item = document.getElementsByTagName('MAIN')[0]; | |
window.addEventListener('wheel', function(e) { | |
if (e.deltaY > 0) item.scrollLeft += 100; | |
else item.scrollLeft -= 100; | |
}); |
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
body{ | |
padding:0; | |
margin:0; | |
} | |
main { | |
position: relative; | |
width: 100vw; | |
height: 100vh; | |
-webkit-overflow-scrolling: touch; | |
} | |
.wrapper { | |
display: flex; | |
flex-direction: row; | |
align-items: flex-start; | |
flex-wrap: nowrap; | |
width: auto; | |
} | |
.wrapper > div { | |
pointer-events: none; | |
flex: 0 0 auto; | |
width: 100vw; | |
height: 100vh; | |
margin: 0; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment