Hello, tell me, please, how can I implement the first slide from this site http://skyservice2016.ru/
Here is the code of what I got. slide_animated is our first slide, it should go up, slide-2 is the next page that goes up for slide_animated.
$('body').on('mousewheel', function(event,type) { if ($(window).width() >= 924) { var el = $('.slide_animated'); if (type == 1 && window.pageYOffset == 0) { if (el.hasClass('active')) { el.removeClass('active'); } } if (!el.hasClass('active') && type == -1) { el.addClass('active'); $('.slide-2').addClass('active'); window.run_animate = true; setTimeout(function() { window.run_animate = false; }, 1200); return false; } if (window.run_animate === true) { return false; } } }); $(window).on('scroll',function(){ if (this.pageYOffset == 0) { $('body').trigger('mousewheel',[1]); } else { $('body').trigger('mousewheel',[-1]); } }); PS Suddenly someone come in handy. I found a solution that suits me more or less.
if ($(window).width() >= 1200) { $('.slide_animated').on('DOMMouseScroll mousewheel', function (ev) { $('body').addClass('fixed-header'); $(this).addClass('active'); var $this = $(this), scrollTop = this.scrollTop, scrollHeight = this.scrollHeight, height = $this.height(), delta = (ev.type == 'DOMMouseScroll' ? ev.originalEvent.detail * -40 : ev.originalEvent.wheelDelta), up = delta > 0; var prevent = function () { ev.stopPropagation(); ev.preventDefault(); ev.returnValue = false; return false; } if (!up && -delta > scrollHeight - height - scrollTop) { // Scrolling down, but this will take us past the bottom. $this.scrollTop(scrollHeight); return prevent(); } else if (up && delta > scrollTop) { // Scrolling up, but this will take us past the top. $this.scrollTop(0); return prevent(); } }); }