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