1(function ($) { 2 "use strict"; 3 var PENCI = PENCI || {}; 4 PENCI.sticky_header = function () { 5 var headersticky = $(".penci_header.penci_builder_sticky_header_desktop"), 6 headertop = $(".penci_header.penci-header-builder.main-builder-header"), 7 headernormal = headertop.outerHeight() + 20, 8 headermobile = $(".penci_navbar_mobile"), 9 lastScrollTop = 0; 10 11 $(window).on("scroll", function () { 12 var st = $(this).scrollTop(); 13 14 if (st > headernormal) { 15 if (headersticky.length) { 16 headersticky.addClass("sticky-apply"); 17 headertop.addClass("ns-apply"); 18 } 19 } else { 20 if (headersticky.length) { 21 headersticky.removeClass("sticky-apply"); 22 headertop.removeClass("ns-apply"); 23 } 24 } 25 26 if (st > headermobile.outerHeight()) { 27 headermobile.addClass("mobile-sticky"); 28 } else { 29 headermobile.removeClass("mobile-sticky"); 30 } 31 32 if (st > lastScrollTop) { 33 headersticky.addClass("scrolldown").removeClass("scrollup"); 34 headermobile.addClass("scrolldown").removeClass("scrollup"); 35 } else { 36 headersticky.addClass("scrollup").removeClass("scrolldown"); 37 headermobile.addClass("scrollup").removeClass("scrolldown"); 38 } 39 lastScrollTop = st; 40 }); 41 }; 42 43 PENCI.main_menu = function () { 44 $(".navigation ul.menu > li.penci-mega-menu").on("mouseenter", function () { 45 var $this = $(this), 46 $row_active = $this.find(".row-active"), 47 $rowsLazy = $row_active.find(".penci-lazy"); 48 $row_active.fadeIn("200").css("display", "inline-block"); 49 }); 50 51 $(".navigation .penci-mega-child-categories a").on( 52 "mouseenter", 53 function () { 54 if ($(this).hasClass("mega-normal-child")) { 55 return; 56 } 57 if (!$(this).hasClass("cat-active")) { 58 var $this = $(this), 59 $row_active = $this.data("id"), 60 $parentA = $this.parent().children("a"), 61 $parent = $this.closest(".penci-megamenu"), 62 $rows = $this 63 .closest(".penci-megamenu") 64 .find(".penci-mega-latest-posts") 65 .children(".penci-mega-row"); 66 $parentA.removeClass("cat-active"); 67 $this.addClass("cat-active"); 68 $rows.hide(); 69 $rows.removeClass("row-active"); 70 $parent 71 .find("." + $row_active) 72 .fadeIn("300") 73 .css("display", "inline-block") 74 .addClass("row-active"); 75 } 76 } 77 ); 78 }; 79 80 PENCI.mobile_menu = function () { 81 // Add indicator 82 83 // Toggle menu when click show/hide menu 84 $(".navigation .button-menu-mobile").on("click", function () { 85 $("body").addClass("open-mobile-builder-sidebar-nav"); 86 }); 87 88 $( 89 ".pc-builder-element nav.penci-vernav-cparent li.menu-item-has-children > a" 90 ).on("click", function (e) { 91 var $this = $(this); 92 e.preventDefault(); 93 $this.children().children().toggleClass("fa-angle-up"); 94 $this.next().slideToggle("fast"); 95 }); 96 97 // Close sidebar nav 98 $("#close-sidebar-nav").on("click", function () { 99 $("body").removeClass("open-sidebar-nav"); 100 }); 101 102 $(".close-mobile-menu-builder").on("click", function (e) { 103 e.preventDefault(); 104 $("body").removeClass("open-mobile-builder-sidebar-nav"); 105 }); 106 }; 107 /* Init functions 108 ---------------------------------------------------------------*/ 109 $(document).ready(function () { 110 PENCI.sticky_header(); 111 PENCI.mobile_menu(); 112 PENCI.main_menu(); 113 $("body").on("penci-ajax-menu-loaded", function () { 114 PENCI.main_menu(); 115 }); 116 }); 117})(jQuery); // EOF
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.