1/* ---------------------------------------------- /* 2 * Preloader 3 /* ---------------------------------------------- */ 4(function(){ 5 6 jQuery(document).ready(function() { 7 8 9 /* ---------------------------------------------- /* 10 * Scroll top 11 /* ---------------------------------------------- */ 12 13 jQuery(window).scroll(function() { 14 if (jQuery(this).scrollTop() > 100) { 15 jQuery('.scroll-up').fadeIn(); 16 } else { 17 jQuery('.scroll-up').fadeOut(); 18 } 19 }); 20 21 jQuery('.scroll-up').click(function () { 22 jQuery("html, body").animate({ 23 scrollTop: 0 24 }, 700); 25 return false; 26 }); 27 28 29 /* ---------------------------------------------- /* 30 * Initialization General Scripts for all pages 31 /* ---------------------------------------------- */ 32 33 var homeSection = jQuery('.home-section'), 34 navbar = jQuery('.navbar-custom'), 35 navHeight = navbar.height(), 36 // worksgrid = jQuery('#works-grid'), 37 width = Math.max(jQuery(window).width(), window.innerWidth), 38 mobileTest = false; 39 40 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 41 mobileTest = true; 42 } 43 44 buildHomeSection(homeSection); 45 navbarAnimation(navbar, homeSection, navHeight); 46 navbarSubmenu(width); 47 hoverDropdown(width, mobileTest); 48 49 jQuery(window).resize(function() { 50 var width = Math.max(jQuery(window).width(), window.innerWidth); 51 buildHomeSection(homeSection); 52 hoverDropdown(width, mobileTest); 53 }); 54 55 /* ---------------------------------------------- /* 56 * Home section height 57 /* ---------------------------------------------- */ 58 59 function buildHomeSection(homeSection) { 60 if (homeSection.length > 0) { 61 if (homeSection.hasClass('home-full-height')) { 62 homeSection.height(jQuery(window).height()); 63 } else { 64 homeSection.height(jQuery(window).height() * 0.85); 65 } 66 } 67 } 68 69 70 /* ---------------------------------------------- /* 71 * Transparent navbar animation 72 /* ---------------------------------------------- */ 73 74 function navbarAnimation(navbar, homeSection, navHeight) { 75 var topScroll = jQuery(window).scrollTop(); 76 if (navbar.length > 0 && homeSection.length > 0) { 77 if(topScroll >= navHeight) { 78 navbar.removeClass('navbar-transparent'); 79 } else { 80 navbar.addClass('navbar-transparent'); 81 } 82 } 83 } 84 85 /* ---------------------------------------------- /* 86 * Navbar submenu 87 /* ---------------------------------------------- */ 88 89 function navbarSubmenu(width) { 90 if (width > breakpoint_settings.menu_breakpoint) { 91 jQuery('.navbar-custom .navbar-nav > li.dropdown').hover(function() { 92 var MenuLeftOffset = jQuery('.dropdown-menu', jQuery(this)).offset().left; 93 var Menu1LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width(); 94 if (width - MenuLeftOffset < Menu1LevelWidth * 2) { 95 jQuery(this).children('.dropdown-menu').addClass('leftauto'); 96 } else { 97 jQuery(this).children('.dropdown-menu').removeClass('leftauto'); 98 } 99 if (jQuery('.dropdown', jQuery(this)).length > 0) { 100 var Menu2LevelWidth = jQuery('.dropdown-menu', jQuery(this)).width(); 101 if (width - MenuLeftOffset - Menu1LevelWidth < Menu2LevelWidth) { 102 jQuery(this).children('.dropdown-menu').addClass('left-side'); 103 } else { 104 jQuery(this).children('.dropdown-menu').removeClass('left-side'); 105 } 106 } 107 }); 108 } 109 } 110 111 /* ---------------------------------------------- /* 112 * Navbar hover dropdown on desctop 113 /* ---------------------------------------------- */ 114 115 function hoverDropdown(width, mobileTest) { 116 if ((width > breakpoint_settings.menu_breakpoint) && (mobileTest !== true)) { 117 jQuery('.navbar-custom').removeClass('open');
118 var delay = 0; 119 var setTimeoutConst; 120 jQuery('.navbar-custom .navbar-nav > li.dropdown, .navbar-custom li.dropdown > ul > li.dropdown').hover(function() { 121 var jQuerythis = jQuery(this); 122 setTimeoutConst = setTimeout(function() { 123 jQuerythis.addClass('open'); 124 jQuerythis.find('.dropdown-toggle').addClass('disabled'); 125 }, delay); 126 }, 127 function() { 128 clearTimeout(setTimeoutConst); 129 jQuery(this).removeClass('open'); 130 jQuery(this).find('.dropdown-toggle').removeClass('disabled'); 131 }); 132 } else { 133 jQuery('.navbar-custom .navbar-nav > li.dropdown, .navbar-custom li.dropdown > ul > li.dropdown').unbind('mouseenter mouseleave'); 134 jQuery('.navbar-custom [data-toggle=dropdown]').not('.binded').addClass('binded').on('click', function(event) { 135 event.preventDefault(); 136 event.stopPropagation(); 137 jQuery(this).parent().siblings().removeClass('open'); 138 jQuery(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open'); 139 jQuery(this).parent().toggleClass('open'); 140 }); 141 } 142 } 143 144 /* ---------------------------------------------- /* 145 * Navbar collapse on click 146 /* ---------------------------------------------- */ 147 148 jQuery(document).on('click','.navbar-collapse.in',function(e) { 149 if( jQuery(e.target).is('a') && jQuery(e.target).attr('class') != 'dropdown-toggle' ) { 150 jQuery(this).collapse('hide'); 151 } 152 }); 153 154 155 if( jQuery(window).width() > breakpoint_settings.menu_breakpoint) { 156 jQuery('.nav li.dropdown').hover(function() { 157 jQuery(this).addClass('open'); 158 159 }, function() { 160 jQuery(this).removeClass('open'); 161 }); 162 jQuery('.nav li.dropdown-submenu').hover(function() { 163 jQuery(this).addClass('open'); 164 }, function() { 165 jQuery(this).removeClass('open'); 166 }); 167 } 168 169 jQuery('li.dropdown').find('.fa-angle-down').each(function(){ 170 jQuery(this).on('click', function(){ 171 if( jQuery(window).width() < breakpoint_settings.menu_breakpoint) { 172 jQuery(this).parent().next().slideToggle(); 173 } 174 return false; 175 }); 176 }); 177 178 if(jQuery(window).width() >= breakpoint_settings.menu_breakpoint){ 179 //For header fix 180 jQuery(window).bind('scroll', function () { 181 if (jQuery(window).scrollTop() > 100) { 182 jQuery('.navigation').addClass('stiky-header'); 183 } else { 184 jQuery('.navigation').removeClass('stiky-header'); 185 } 186 }); 187 188 } 189 190 }); 191})(jQuery);
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.