1/** 2Core script to handle the entire theme and core functions 3**/ 4var Layout = function() { 5 6 var layoutImgPath = 'admin/layout5/img/'; 7 8 var layoutCssPath = 'admin/layout5/css/'; 9 10 var resBreakpointMd = Metronic.getResponsiveBreakpoint('md'); 11 12 // handle on page scroll 13 var handleHeaderOnScroll = function() { 14 if ($(window).scrollTop() > 60) { 15 $("body").addClass("page-on-scroll"); 16 } else { 17 $("body").removeClass("page-on-scroll"); 18 } 19 } 20 21 // Handles active menu to avoid closing click to content 22 23 // handle go to top button 24 var handleGo2Top = function () { 25 var Go2TopOperation = function(){ 26 var CurrentWindowPosition = $(window).scrollTop();// current vertical position 27 if (CurrentWindowPosition > 100) { 28 $(".go2top").show(); 29 } else { 30 $(".go2top").hide(); 31 } 32 }; 33 34 Go2TopOperation();// call headerFix() when the page was loaded 35 if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { 36 $(window).bind("touchend touchcancel touchleave", function(e){ 37 Go2TopOperation(); 38 }); 39 } else { 40 $(window).scroll(function() { 41 Go2TopOperation(); 42 }); 43 } 44 45 $(".go2top").click(function(e) { 46 e.preventDefault(); 47 $("html, body").animate({ scrollTop: 0 }, 600); 48 }); 49 }; 50 51 var handleHeaderMenu = function() { 52 $('.page-header .navbar-nav > .dropdown, .page-header .navbar-nav > .dropdown > .dropdown-menu > .dropdown').click(function(e) { 53 e.stopPropagation(); 54 55 var links = $(this).parent().find('> .dropdown'); 56 57 if (Metronic.getViewPort().width < resBreakpointMd) { 58 if ($(this).hasClass('open')) { 59 links.removeClass('open'); 60 } else { 61 links.removeClass('open'); 62 $(this).addClass('open'); 63 Metronic.scrollTo($(this)); 64 } 65 } else { 66 if ($(this).hasClass('more-dropdown')) { 67 return; 68 } 69 links.removeClass('open'); 70 $(this).addClass('open'); 71 Metronic.scrollTo($(this)); 72 } 73 }); 74 }; 75 76 // Handles main menu on window resize 77 var handleMainMenuOnResize = function() { 78 // handle hover dropdown menu for desktop devices only 79 var width = Metronic.getViewPort().width; 80 var menu = $(".page-header .navbar-nav"); 81 if (width >= resBreakpointMd && menu.data('breakpoint') !== 'desktop') { 82 menu.data('breakpoint', 'desktop'); 83 $('[data-hover="extended-dropdown"]', menu).not('.hover-initialized').each(function() { 84 $(this).dropdownHover(); 85 $(this).addClass('hover-initialized'); 86 }); 87 } else if (width < resBreakpointMd && menu.data('breakpoint') !== 'mobile') { 88 menu.data('breakpoint', 'mobile'); 89 // disable hover bootstrap dropdowns plugin 90 $('[data-hover="extended-dropdown"].hover-initialized', menu).each(function() { 91 $(this).unbind('hover'); 92 $(this).parent().unbind('hover').find('.dropdown-submenu').each(function() { 93 $(this).unbind('hover'); 94 }); 95 $(this).removeClass('hover-initialized'); 96 }); 97 } 98 }; 99 100 return { 101 102 // Main init methods to initialize the layout 103 // IMPORTANT!!!: Do not modify the core handlers call order. 104 105 init: function () { 106 handleGo2Top(); 107 handleHeaderOnScroll(); 108 handleHeaderMenu(); 109 handleMainMenuOnResize(); 110 Metronic.addResizeHandler(handleMainMenuOnResize); // handle main menu on window resize 111 112 // handle minimized header on page scroll 113 $(window).scroll(function() { 114 handleHeaderOnScroll(); 115 }); 116 }, 117 118 getLayoutImgPath: function() { 119 return Metronic.getAssetsPath() + layoutImgPath; 120 }, 121 122 getLayoutCssPath: function() { 123 return Metronic.getAssetsPath() + layoutCssPath; 124 } 125 }; 126 127}();
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.