var ImagesOpt = function(){ setTimeout(function(){ $('[data-src]').each(function(index){ let that = $(this); if( ($(window).scrollTop() + $(window).height()) > $(this).offset().top + 100 ) { $(this).attr('src', $(this).data('src')); $(this).removeAttr('data-src') } }); },300); }; $(window).on('scroll', ImagesOpt); $(window).on('resize', ImagesOpt); $(window).on('load', ImagesOpt); $(window).ajaxSuccess(ImagesOpt); // ############################### // ## CLICKS & EVENTS // ############################### function siteEvents(){ $(".MenuPopupContent .CloseIt").click(function(event) { $("body").removeClass('activeMenu'); return false; }); $(".PageHeader .MenuBtn").click(function(event) { $("body").addClass('activeMenu'); }); $(window).on('scroll',function(){ if ($(this).scrollTop() > 500) { $(".footerMenu").addClass('show'); }else{ $(".footerMenu").removeClass('show'); } }); $(".footerMenu ul.CenterItems li.OpenSubMenu").click(function(event) { $(".footerMenu").toggleClass('SubMenuActive') }); $(".DropdownButton > span").click(function(event) { $(this).parent().parent().find('.DropdownButton').not($(this).parent()).removeClass('active'); $(this).parent().toggleClass('active'); if ($(this).parent().hasClass('active')) { $("#MainUL").addClass('active'); }else{ $("#MainUL").removeClass('active'); } }); $(document).mouseup(function(e) { var container = $(".SearchFormHero"); if (!container.is(e.target) && container.has(e.target).length === 0) { $("body").removeClass('SearchActive'); } var container = $(".DropdownButton"); if (!container.is(e.target) && container.has(e.target).length === 0) { container.removeClass('active'); } var container = $(".UsersBtn ul"); if (!container.is(e.target) && container.has(e.target).length === 0) { container.hide(); } var container = $(".SearchBooxAjax"); if (!container.is(e.target) && container.has(e.target).length === 0) { container.html(''); $('body').removeClass('ISSearching'); } var container = $(".userListHead"); if (!container.is(e.target) && container.has(e.target).length === 0) { $('.userListHead').removeClass('ISActive'); } var container = $(".NotifcationsLists"); if (!container.is(e.target) && container.has(e.target).length === 0) { $('.userListHead').removeClass('Show'); } }); } // ############################# // ########## AddToList ######## // ############################# function notUserMsg(){ $.alert({ title: 'رساله', content: 'لاستخدام هذه الميزه قم بتسجيل الدخول اولا', theme: 'Material', type: 'red', closeIcon: true, animationBounce: 2, animationSpeed: 400, animation: 'scale', rtl: true, buttons: { login: { text: 'تسجيل الدخول', btnClass: 'btn-blue', action: function () { GoToURL( HomeURL + "/login" ); } }, register: { text: 'تسجيل جديد', btnClass: 'btn-green', action: function () { GoToURL( HomeURL + "/join" ); } } } }); } // ##### // Sliders // ### function SetupSliders(){ // ### BIG SLIDER ## $('.WorkTeamSlider .owl-carousel').owlCarousel({ items: 1, responsiveClass:true, stopOnHover: true, smartSpeed: 600, loop: 0, autoWidth: true, rtl:true, dots:false, nav:false, margin: 10, autoPlay: true, singleItem: true, addClassActive: true, }); $(".WorkTeamPrev").click(function(event) { $(".WorkTeamSlider .owl-carousel").find('.owl-next').click(); }); $(".WorkTeamNext").click(function(event) { $(".WorkTeamSlider .owl-carousel").find('.owl-prev').click(); }); $(".NextSlideBig").click(function(event) { $(".bigSlider").find('.owl-next').click(); }); $(".PrevSlideBig").click(function(event) { $(".bigSlider").find('.owl-prev').click(); }); } jQuery(document).ready(function($) { $('.SliderInSection .owl-carousel').owlCarousel({ items: 1, responsiveClass:true, stopOnHover: true, smartSpeed: 600, loop: false, autoWidth: true, rtl:true, nav:false, margin: 15, autoPlay: true, autoplayTimeout:7000, autoplayHoverPause:true, addClassActive: true, }); setTimeout(function(){ $(".SliderInSection").addClass('show'); },500); headerHeight = $("header.PageHeader").height(); headerHeightVH = "calc(100vh - "+ headerHeight+"px)"; $(".searching-section").css({ top:headerHeight+"px", "height": headerHeightVH, }); setTimeout(function(){ $('.imgOptimzer').each(function(index){ if( ($(window).scrollTop() + $(window).height()) > $(this).offset().top + 100 ) { $(this).attr('src', $(this).data('image')).on('load', function(response){ if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { $(this).remove(); } else { $(this).addClass('Loaded'); $(this).removeAttr('data-image') } }); } }); $("[data-style]").each(function(index) { $(this).attr("style",$(this).data('style')).removeAttr('data-style'); }); },1000); $(".NavigationMenu > li > a").addClass("HoverBefore"); $("body").addClass('LoadedBody'); "use strict"; // ###################### // Set Functions // ###################### SetupSliders(); siteEvents(); setTimeout(function(){ $('.MainSlides').owlCarousel({ items: 1, responsiveClass:true, stopOnHover: true, smartSpeed: 600, loop: true, autoWidth: true, rtl:true, nav:false, margin: 20, autoPlay: true, singleItem: true, addClassActive: true, navText : ["",""], }); $(".LeftHero .MainSlides").addClass('show'); },500) }); $("body").on('click', '.LeftHero .SlidesPrev', function(event) { event.preventDefault(); $(".MainSlides .owl-next").click(); }); $("body").on('click', '.LeftHero .SlidesNext', function(event) { event.preventDefault(); $(".MainSlides .owl-prev").click(); }); $("body").on('submit', '.SearchINPop form', function(event) { event.preventDefault(); }); $("body").on('click', '.search-contentarea .title-bar > a', function(event) { event.preventDefault(); $.ajax({ url: MyAjaxURL+'SearchHistory.php', type: 'POST', data: {text: $(".SearchINPop form input").val()}, }) .done(function() { console.log("success"); }); }); spinnerLoad = $('
'); $("body").on('click', '.MovieBlock .PlayButton', function(event) { event.stopPropagation(); ThisItem = $(this); href = $(this).next("a").attr("href"); $(".MovieBlock").not(ThisItem.parent()).removeClass('LoadedDone'); setTimeout(function(){ $(".MovieBlock").not(ThisItem.parent()).removeClass('activeItem'); },500); $(this).parent().addClass('activeItem'); $(this).parent().find(".LoadingArea").html('
') setTimeout(function(){ $.ajax({ url: MyAjaxURL+'Home/Loadblock.php', type: 'POST', data: {href: href , series: ThisItem.data("series") , seriesget:ThisItem.data("load")}, }) .done(function(date) { ThisItem.parent().find(".LoadingArea").html(date); setTimeout(function(){ ThisItem.parent().addClass('LoadedDone'); },10); }) .fail(function() { ThisItem.parent().removeClass('activeItem'); }); },500); }); $("body").on('click', '.SlideerPrev', function(event) { event.preventDefault(); $(this).parent().find(".owl-next").click(); }); $("body").on('click', '.SlideerNext', function(event) { event.preventDefault(); $(this).parent().find(".owl-prev").click(); }); var ImagesLoader = function(){ $('.imgOptimzer').each(function(index){ if( ($(window).scrollTop() + $(window).height()) > $(this).offset().top + 100 ) { $(this).attr('src', $(this).data('image')).on('load', function(response){ if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { $(this).remove(); } else { $(this).addClass('Loaded'); $(this).removeAttr('data-image') } }); } }); }; $(window).on('ready', ImagesLoader); $(window).on('load', ImagesLoader); $(window).on('scroll', ImagesLoader); $(window).on('resize', ImagesLoader); $(window).ajaxSuccess(ImagesLoader); function ShowTrailer(ele) { $(".PopupTrailer").addClass('Opened').find(".content").html(spinnerLoad); href = $(ele).data("url"); $.ajax({ url: MyAjaxURL+'Home/LoadTrailer.php', type: 'POST', data: {href: href}, }) .done(function(date) { $(".PopupTrailer").find(".content").html(date); }); } function CloseTrailer() { $(".PopupTrailer").removeClass('Opened').find(".content").html(spinnerLoad); } $(window).scroll(function(event) { if( $(window).scrollTop() > 500 ) { $(".gtop").addClass('show'); }else{ $(".gtop").removeClass('show'); } }); $("body").on('click', '.gtop', function(event) { event.preventDefault(); $("body,html").animate({ scrollTop: "0", },1000); }); $("body").on('submit', '#joinUsNow', function(event) { event.preventDefault(); $.ajax({ url: MyAjaxURL+"Users/Register.php", data: { fname: $("[name=userFName]").val(), lname: $("[name=userLName]").val(), mail: $('[name=userMail]').val(), display: $("[name=userDisplay]").val(), pass: $("[name=userPWD]").val(), }, type:"POST", success: function(msg){ $(".ajaxfyAlerts").html(msg); }, }); }); $("body").on('submit', '#loginNow', function(event) { event.preventDefault(); $(".ajaxfyAlerts").html("انتظر لحظة .."); $.ajax({ url: MyAjaxURL+"Users/Login.php", data: { username: $("[name=userMail]").val(), password : $("[name=userPWD]").val() }, type: "POST", success: function(msg){ $(".ajaxfyAlerts").html(msg); } }) }); $("body").on('click', '.TaxPageFilterItem', function(event) { $(this).parent().find('.TaxPageFilterItem').not($(this)).removeClass('Selected'); $(this).toggleClass('Selected'); if ($(this).hasClass('Selected')) { $("body").addClass('FilterOpened'); }else{ $("body").removeClass('FilterOpened'); } }); $("body").on('focusin', 'form.SearchFormHero input[type="text"]', function() { $("body").addClass('SearchActive'); }); $("body").on('keyup', 'form.SearchFormHero input[type="text"]', function(event) { event.preventDefault(); $("body").addClass('SearchActive'); ThisEle = $(this); setTimeout(function(){ if (ThisEle.val() != "") { $.ajax({ url: MyAjaxURL+'SearchHistory.php', type: 'POST', data: {text: $('form.SearchFormHero input[type="text"]').val() , "cu" :SearchHistory}, }); } },5000); if( ThisEle.val() != '' ) { $(".ISHome").find('.SearchFormHero').addClass('homeSearcher'); $('.LiveSearchInner').html('
'); $.ajax({ url: MyAjaxURL + 'Searching.php', type: 'POST', data: {'search':ThisEle.val()}, dataType: "html", success: function(msg) { $('.LiveSearchInner').html(msg); } }); }else{ $(".ISHome").find('form.SearchFormHero').removeClass('homeSearcher'); $("body").removeClass('SearchActive'); } }); $("body").on('submit', 'form.SearchFormHero', function(event) { if (ThisEle.val() != "") { event.preventDefault(); $.ajax({ url: MyAjaxURL+'SearchHistory.php', type: 'POST', data: {text: $('form.SearchFormHero input[type="text"]').val()}, success:function(){ javascript:location.href = HomeURL + "/find/?find=" + $('form.SearchFormHero input[type="text"]').val(); } }); } }); $("body").on('click', 'div#SearchInnerList li a', function(event) { event.preventDefault(); href = $(this).attr("href"); post__id = $(this).data('id'); $.ajax({ url: MyAjaxURL+'SearchHistory.php', type: 'POST', data: {text: post__id }, success:function(){ javascript:location.href = href; } }); }); $("body").on('click', '.LoggedINUserBtn ', function(event) { $(".userListHead").toggleClass('ISActive'); if($('.NotifcationsLists').hasClass('Show')){ $('.NotifcationsLists').removeClass('Show'); } }); $("body").on('click', '.FollowTerm', function(event) { if (isUser == "false") { notUserMsg(); } else { $.ajax({ url: MyAjaxURL+'Users/FollowTerm.php', type: 'POST', data: {term_id: $(this).data("term") }, success:function(requestResponse){ $("body").append(requestResponse) } }); } }); $("body").on('click', '.AddToMyHome', function(event) { if (isUser == "false") { notUserMsg(); } else { $.ajax({ url: MyAjaxURL+'Users/HomeBlock.php', type: 'POST', data: {term_id: $(this).data("term") }, success:function(requestResponse){ $("body").append(requestResponse) } }); } }); $("body").on('click', '.NotificationListBTN ', function(event) { $(".NotifcationsLists").toggleClass('Show'); if($('.userListHead').hasClass('ISActive')){ $('.userListHead').removeClass('ISActive'); } $.ajax({ url:MyAjaxURL+'Users/NotifcationsRead.php', type: 'POST', }) }); $("body").on('click', '.TaxPageFilterDrop ul li ', function(event) { $("body").addClass('filterSelected'); $(this).addClass('active').siblings().removeClass('active'); $(this).parent().parent().parent().find('span.HoverAfter').find('em').html($(this).data('name')); $(".ShowResult").addClass('Show'); }); $("body").on('click', '.RatingFilter > ul span ', function(event) { $(".ShowResult").addClass('Show'); $("body").addClass('filterSelected'); $(this).addClass('active').siblings().removeClass('active'); }); $("body").on('click', '.ShowResult ', function(event) { $("body,html").animate({scrollTop: $(".TitleCenteral").offset().top - 30 }, 500); $(".TaxPagePosts .container").html('
'); sent_ajax = { category : $('.TaxPageFilterDrop ul li[data-tax=category].active').data('term'), year : $('.TaxPageFilterDrop ul li[data-tax=release-year].active').data('term'), genre : $('.TaxPageFilterDrop ul li[data-tax=genre].active').data('term'), language : $('.TaxPageFilterDrop ul li[data-tax=language].active').data('term'), quality : $('.TaxPageFilterDrop ul li[data-tax=quality].active').data('term'), country : $('.TaxPageFilterDrop ul li[data-tax=country].active').data('term'), rate : $('.RatingFilter > ul span.active').data('rate'), currentTermID : currentTermID, }; $.ajax({ url:MyAjaxURL+'Home/FilteringShows.php', type: 'POST', data: sent_ajax, }) .done(function(requestResponse) { $(".TaxPagePosts .container").html(requestResponse); }); }); $("body").on('click', '.AddFav , .AddWatched', function(event) { metaAction(this); }); function metaAction(ele){ if (isUser == "false") { notUserMsg(); } else { getClass = $(ele).attr("class"); $.ajax({ url: MyAjaxURL+'Users/MetaAction.php', type: 'POST', data: {post_id: $(ele).data("post") , meta: getClass.replace(/ /g,'') , type:$(ele).data("type") }, success:function(requestResponse){ $("body").append(requestResponse) } }); } } $("body").on('click', '#MoreRelated', function(event) { offset = $(".Blocks-UL > .MovieBlock").length; event.preventDefault(); $(this).css({ opacity: '0.5', "pointer-events": 'none' }); $("#RelatedUL").append(spinnerLoad); $.ajax({ url: MyAjaxURL+'Single/RelatedMore.php', type: 'POST', data: {term: $(".relatedPosts #RelatedTerms a.active").data("term") , offset : offset }, success:function(requestResponse){ $("#RelatedUL").find(spinnerLoad).remove(); $("#RelatedUL").append(requestResponse); $("#MoreRelated").css({ "opacity": '1', "pointer-events": 'initial' }); } }); }); $("body").on('click', '.relatedPosts #RelatedTerms a', function(event) { event.preventDefault(); $(this).addClass('active').siblings().removeClass('active'); $("#MoreRelated").css({ "opacity": '0.5', "pointer-events": 'none' }); $("#RelatedUL").html(spinnerLoad); $.ajax({ url: MyAjaxURL+'Single/Related.php', type: 'POST', data: {term: $(this).data("term") }, success:function(requestResponse){ $("#MoreRelated").css({ "opacity": '1', "pointer-events": 'initial' }); $("#RelatedUL").html(requestResponse); } }); }); function likesAction(ele){ if (isUser == "false") { notUserMsg(); } else { $.ajax({ url: MyAjaxURL+'Users/LikesAction.php', type: 'POST', data: {post_id: $(ele).data("post") , "meta": $(ele).data('like') , type: $(ele).data("type") }, success:function(requestResponse){ $("body").append(requestResponse) } }); } } $("body").on('click', '[data-like]', function(event) { likesAction(this); }); $("body").on('click', '.containerServers>ul>li', function(event) { event.preventDefault(); $(this).addClass('active').siblings().removeClass('active'); $(".containerIframe").html('
') $.ajax({ url: MyAjaxURL+'Single/Server.php', type: 'POST', data: {post_id: $(this).data("post") , server: $(this).data('server'), "qu": $(this).data("qu") }, success:function(requestResponse){ $(".containerIframe").html(requestResponse); } }); }); $(function() { itemf = $(".containerServers>ul>li:nth-of-type(1)"); itemf.addClass("active").siblings().removeClass("active"); $.ajax({ url: MyAjaxURL+'Single/Server.php', type: 'POST', data: {post_id: itemf.data("post") , server: itemf.data('server'), "qu": itemf.data("qu") }, success:function(requestResponse){ $(".containerIframe").html(requestResponse); } }); }); if (isSingle == "true") { setTimeout(function(){ $.ajax({ url: MyAjaxURL+'Users/FavCats.php', type: 'POST', data: {post: $("body").data("post") }, }); },50000); } $("body").on('click', '.SeasonsListHolder>ul>li', function(event) { $("#MoreEpisodes").data('slug', $(this).data('slug')) event.preventDefault(); $(".ContainerEpisodesList").html(spinnerLoad); $(this).addClass('active').siblings().removeClass('active'); $.ajax({ url: MyAjaxURL+'Single/Episodes.php', type: 'POST', dataType: 'html', data: {season: $(this).data('season') ,post_id: $(this).data('id') }, success:function(requesetResponse){ $(".ContainerEpisodesList").html(requesetResponse); } }); }); $("body").on('click', '.FollowSeries', function(event) { if (isUser == "false") { notUserMsg(); } else { $.ajax({ url: MyAjaxURL+'Users/MetaAction.php', type: 'POST', data: {post_id: $(this).data("post") , "meta": "Followselary" }, success:function(requestResponse){ $("body").append(requestResponse) } }); } }); $('body').on('keydown', '.TaxFilterTitle input', function(evt){ shTypeing = $(this).parent().data('type'); setTimeout(function(){ searchVal = $('#'+shTypeing+'Finder').val(); if(evt.keyCode === 27) { $(this).val(''); $('li[data-tax='+shTypeing+']').show(); }else if(searchVal == '') { $(this).val(''); $('li[data-tax='+shTypeing+']').show(); }else { $('li[data-tax='+shTypeing+']').hide(); $('li[data-tax='+shTypeing+']').each(function(ints, int){ if ($(int).find('span').text().indexOf(searchVal) >= 0) { $(int).show(); } }); } },100); }); $("body").on('click', '.TaxFilter>ul>li ', function(event) { $(this).addClass('active').siblings().removeClass('active'); $("body,html").animate({scrollTop: $(".TitleCenteral").offset().top - 30 }, 500); $("#MainUL .container").html(spinnerLoad); sent_ajax = { category : $('.TaxFilter>ul>li[data-tax=category].active').data('term'), year : $('.TaxFilter>ul>li[data-tax=release-year].active').data('term'), genre : $('.TaxFilter>ul>li[data-tax=genre].active').data('term'), language : $('.TaxFilter>ul>li[data-tax=language].active').data('term'), quality : $('.TaxFilter>ul>li[data-tax=quality].active').data('term'), }; $.ajax({ url:MyAjaxURL+'Home/FilteringHome.php', type: 'POST', data: sent_ajax, }) .done(function(requestResponse) { $(".DropdownButton").removeClass('active'); $("#MainUL").removeClass('active'); $("#MainUL .container").html(requestResponse); }); }); $("body").on('click', '.DarkMode', function(event) { event.preventDefault(); $("body").toggleClass('NightMode'); $.ajax({ url:MyAjaxURL+'SetColor.php', type: 'POST', success:function(response){ $("body").append(response) } }); }); $("body").on('keyup', '.SearchINPop form input', function(event) { event.preventDefault(); searchValue = $(this).val(); $(".ChangerSearchArea").html(spinnerLoad); $(".search-contentarea .title-bar h3 em").html(searchValue); $(".search-contentarea .title-bar > a").attr("href", HomeURL + "?s="+searchValue); if (searchValue != "") { $.ajax({ url: MyAjaxURL + 'SearchingTwo.php', type: 'POST', data: {'search':searchValue , type:$("section.searching-section ul.search-filter li.active").data('search')}, dataType: "html", success: function(response) { $(".ChangerSearchArea").html(response); } }); } }); $('body').on('click', '.PageHeader .LeftHeader .SearchBtn', function(e){ if (!$("body").hasClass('SearchingNow')) { $("body").addClass('SearchingNow'); }else{ $("body").removeClass('SearchingNow'); } }); $("body").on('click', 'section.searching-section ul.search-filter li', function() { $(this).addClass('active').siblings().removeClass('active'); $(".ChangerSearchArea").html(spinnerLoad); $.ajax({ url: MyAjaxURL + 'SearchingTwo.php', type: 'POST', data: {'search':$(".SearchINPop form input").val() , type:$("section.searching-section ul.search-filter li.active").data('search')}, dataType: "html", success: function(response) { $(".ChangerSearchArea").html(response); } }); }); $("body").on('click', '#RelatedSeries a', function(event) { event.preventDefault(); $(this).addClass('active').siblings().removeClass('active'); $("#MoreRelated").css({ "opacity": '0.5', "pointer-events": 'none' }); $("#SeriesRelatedUL").html(spinnerLoad); $.ajax({ url: MyAjaxURL+'Single/RelatedSeries.php', type: 'POST', data: {term: $(this).data("term") }, success:function(requestResponse){ $("#MoreRelated").css({ "opacity": '1', "pointer-events": 'initial' }); $("#SeriesRelatedUL").html(requestResponse); } }); }); $("body").on('click', '.MainMenuOverlay', function(event) { event.preventDefault(); $("body").removeClass('activeMenu') }); $("body").on('click', '#MoreEpisodes', function() { $(this).css({ "opacity": '0.5', "pointer-events": 'none' }); $(".ContainerEpisodesList").append(spinnerLoad); $.ajax({ url: MyAjaxURL + 'Single/MoreEpisodes.php', type: 'POST', data: {"season":$(this).data("slug") , offset: $(".ContainerEpisodesList a").length }, dataType: "html", success: function(response) { $("#MoreEpisodes").css({ "opacity": '1', "pointer-events": 'initial' }); $(".ContainerEpisodesList").find(spinnerLoad).remove(); $(".ContainerEpisodesList").append(response); } }); }); $("body").on('click', '.SlidersFilter a', function(event) { event.preventDefault(); ThisItem = $(this); ThisItem.parent().find('a').css({ "opacity": '0.5', "pointer-events": 'none' }); ThisItem.addClass('active').siblings().removeClass('active'); ThisItem.parent().next(".SliderInSection").html(spinnerLoad); findL = $(this).parent().next(".SliderInSection"); $.ajax({ url: MyAjaxURL+'HomeSlider.php', type: 'POST', data: {cat: ThisItem.data("term") }, success:function(requestResponse){ ThisItem.parent().find('a').css({ "opacity": '1', "pointer-events": 'initial' }); findL.html(requestResponse); } }); }); $("body").on('click', '[data-show]', function(event) { event.preventDefault(); $("a[data-s="+$(this).data("show")+"]").toggle(); }); $(function() { if( $('ramdan--slider').length > 0 ) { var MainSlider = $('ramdan--slider .Innser--Slider--Root'); MainSlider.owlCarousel({ animateIn: 'fadeIn', animateOut: 'fadeOut', items:1, nav:false, smartSpeed:400, loop: true, lazyLoad: true, dots: true, dotsData: true, // autoplay: true, autoplayHoverPause:true }); $('body').on('click','innser--slider--root .owl-dots > .owl-dot',function(){ MainSlider.trigger('to.owl.carousel',[$(this).index(), 1000]); }); } $(".owl-dots > .owl-dot").addClass("active__link"); if( $('.Innser--Slider--Root').length > 0 ) { $('.Innser--Slider--Root').owlCarousel({ loop:true, margin:20, nav:true, items:1, rtl:true, autoplay:true, autoplayTimeout:5000, autoplayHoverPause:false, }); } }); let lastScrollTop = 0; let navbarHeight = $(".PageHeader").outerHeight(); let MathNUm = 15; function hasScrolled() { let st = $(this).scrollTop(); if (Math.abs(lastScrollTop - st) <= MathNUm) return; if (st > lastScrollTop && st > navbarHeight) { $(".PageHeader").addClass("header-onscroll"); } else { if (st + $(window).height() < $(document).height()) { $(".PageHeader").removeClass("header-onscroll"); } } lastScrollTop = st; } jQuery(document).ready(function($) { $("body").css('padding-top', navbarHeight); doScrolled = false; $(window).on("scroll", function () { doScrolled = true; }); setInterval(function () { if (doScrolled) { hasScrolled(); doScrolled = false; } }, 20); }); $(window).on("resize", function () { $("body").css('padding-top', navbarHeight); });