isAnimate = false; actSlide = lastSlide = 1; totSlide = 0; $(document) .mousewheel(function(event, delta) { event.preventDefault(); if (!isAnimate) { if(totSlide == 0){ totSlide = $('.intro .i-section').length; } if(totSlide > 1){ // Ruszamy if(delta < 0){ // Dalej actSlide+=1; if(actSlide >= totSlide){ actSlide = totSlide; } } else if(delta > 0){ // Poprzednie actSlide-=1; if(actSlide == 0){ actSlide = 1; } } if(actSlide != lastSlide) { var nPos = $('.intro .i-section').eq((actSlide-1)).offset().top; isAnimate = true; setTimeout(function(){ $('html,body').animate({ scrollTop: nPos-50 }, 700, function(){ isAnimate = false; }); }, 100); lastSlide = actSlide; } } } }); $(document).ready(function(){ isAnimate = true; var bPos = 0; var _url = top.location.href; /* if(_url.indexOf("#") > -1){ _e = _url.split("#"); _n = parseFloat(_e[1])-1; console.log(_n); bPos = $('.intro .i-section').eq(_n).offset().top - 50; actSlide = _n; } */ if ($(window).width() > 1024){ var wh = $(window).height(); var inHeight = wh - $('#main-header').outerHeight() - 150; $('.intro .i-section, .intro .gal-item').height(inHeight); } $('html,body').animate({ scrollTop: bPos }, 100, function(){ isAnimate = false; }); // Zabiegaj linkom # $('a[href=#]').click(function(e){ e.preventDefault(); }); if($(window).width() > 800) { var hvText = inHeight - 225; $('.v-text').height(hvText); $('.v-text').mCustomScrollbar(); } else { $('.v-text').css("height", "auto"); } $('.v-text').each(function(){ $(this).append('
'); }); }); $(window).load(function(){ $('.intro .gallery').each(function(){ console.log($(this).find(".gal-item").length); if($(this).find(".gal-item").length > 1) { $(this).owlCarousel({ loop: true, lazyLoad:true, items:1, nav : true, dots: true, autoplay:false, autoplayTimeout:4000, autoplayHoverPause:false, smartSpeed: 1250 }); } }); }); $(document).on('click', '.mobile-nav-toggle', function(evt){ evt.preventDefault(); evt.stopPropagation(); $('.mobile-nav nav').toggleClass('show'); });