I have a 100% height x 100% width fixed main container on my website, in which I would like to detect the scroll event. The page structure could be described as a slider with fixed active slide and non-active slides being positioned absolutely below the main container. I got it working perfectly when I have a pager on the side. The thing is, I would also like user to be able to switch between slides using only mouse scroll (go to next slide on scroll down, and drop the slide down revealing the previous one, while scrolling up). Is there any way I can do it, keeping my page structure as is? The fiddle can be found here: http://jsfiddle.net/tts4nhun/1/ (it's just a quick recreation and I think a few things are unnecessary in css, but they don't really change anything when it comes to the content of this question).
HTML:
<div class="wrapper">
<div class="slide slide-1"></div>
<div class="slide slide-2"></div>
</div>
CSS:
.wrapper {
position:absolute;
background:red;
width:100%;
height:100%;
top:0;
left:0;
overflow:hidden;
}
.slide {
width:100%;
height:100%;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.slide-1 {
position:fixed;
top:0;
left:0;
background:blue;
}
.slide-2 {
position:absolute;
top:100%;
left:0;
background:green;
}
.slide-2.active {
position:fixed;
top:0;
left:0;
}
jQuery :
$('.slide-1').click(function(){
$('.slide-2').addClass('active');
});
I'm not asking about checking if the user scrolled down or up, but if they did at all.
I'll be very grateful for any advice. Thanks, E.
e: To clarify, I want the scrolling itself to be disabled (user shouldn't be able to scroll down the website in a traditional way). The reason I want to detect the scroll event is, I want to swap active classes on a single scroll down or up. (That is also the reason why I want to keep the overflow:hidden property - I want the website to resemble a slideshow and use the scroll up/scroll down events just like up/down arrows).