(function($){ $(document).ready(function(){ $('.counter').countUp({ time: 600 }); $(window).on('scroll', function(){ wst = $(window).scrollTop(); pvH = $('.pv_area').height()/4*3 console.log(wst) if(wst > pvH) { $('#header').addClass('fix') } else { $('#header').removeClass('fix') } }) $('.parallax[data-type="background"]').each(function(){ var $bgobj = $(this); // assigning the object var $window = $(window) $(window).scroll(function() { var yPos = -($window.scrollTop() / ($bgobj.data('speed') * 1000)); // Put together our final background position var coords = '50% '+ yPos + 'px'; // Move the background $bgobj.css({ backgroundPosition: coords }); }); }); $('.img_slide').slick({ infinite: true, arrows: false, dot: false, autoplay: true, autoplaySpeed: 3000, pauseOnHover: false }) }) $(window).on('load', function(){ wst = $(window).scrollTop(); pvH = $('.pv_area').height()/4*3 if(wst > pvH) { $('#header').addClass('fix') } else { $('#header').removeClass('fix') } }) $(window).on('load resize', function(){ ww = $(window).width(); if(ww < 1025) { $('body').removeClass('hover'); $('.parallax').removeClass('parallax'); } else { $('body').addClass('hover') } }) })(jQuery);