1(function($){ 2 3 /* ---------------------------------------------- /* 4 * Preloader 5 /* ---------------------------------------------- */ 6 7 $(window).load(function() { 8 $('.loader').fadeOut(); 9 $('.page-loader').delay(350).fadeOut('slow'); 10 }); 11 12 $(document).ready(function() { 13 14 /* ---------------------------------------------- /* 15 * Initialization General Scripts for all pages 16 /* ---------------------------------------------- */ 17 18 var homeSection = $('.home-section'), 19 navbar = $('.navbar-custom'), 20 navHeight = navbar.height(), 21 worksgrid = $('#works-grid'), 22 width = Math.max($(window).width(), window.innerWidth), 23 mobileTest; 24 25 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 26 mobileTest = true; 27 } 28 29 buildHomeSection(homeSection); 30 navbarAnimation(navbar, homeSection, navHeight); 31 navbarSubmenu(width); 32 hoverDropdown(width, mobileTest); 33 34 $(window).resize(function() { 35 var width = Math.max($(window).width(), window.innerWidth); 36 buildHomeSection(homeSection); 37 hoverDropdown(width, mobileTest); 38 }); 39 40 $(window).scroll(function() { 41 effectsHomeSection(homeSection, this); 42 navbarAnimation(navbar, homeSection, navHeight); 43 }); 44 45 /* ---------------------------------------------- /* 46 * Home section height 47 /* ---------------------------------------------- */ 48 49 function buildHomeSection(homeSection) { 50 if (homeSection.length > 0) { 51 if (homeSection.hasClass('home-full-height')) { 52 homeSection.height($(window).height()); 53 } else { 54 homeSection.height($(window).height() * 0.85); 55 } 56 } else { 57 if( $('body.home' ).length>0 && homeSection.length<1 ) { 58 $('.main').css('margin-top', $('.navbar-custom').outerHeight() ); 59 } 60 } 61 } 62 63 /* ---------------------------------------------- /* 64 * Home section effects 65 /* ---------------------------------------------- */ 66 67 function effectsHomeSection(homeSection, scrollTopp) { 68 if (homeSection.length > 0) { 69 var homeSHeight = homeSection.height(); 70 var topScroll = $(document).scrollTop(); 71 if ( ( homeSection.hasClass( 'home-parallax' ) ) && ( $( scrollTopp ).scrollTop() <= homeSHeight ) ) { 72 $( '.home-slider-overlay' ).css( 'opacity', ( 0.3 + 0.7 * topScroll / $(window).height() ) ); 73 } 74 if (homeSection.hasClass('home-fade') && ($(scrollTopp).scrollTop() <= homeSHeight)) { 75 var caption = $('.caption-content'); 76 caption.css('opacity', (1 - topScroll/homeSection.height() * 1)); 77 } 78 } 79 } 80 81 /* ---------------------------------------------- /* 82 * Intro slider setup 83 /* ---------------------------------------------- */ 84 85 if( $('.hero-slider').length > 0 ) { 86 $('.hero-slider').flexslider( { 87 animation: "fade", 88 animationSpeed: 1000, 89 animationLoop: true, 90 prevText: '', 91 nextText: '', 92 before: function(slider) { 93 $('.hs-caption').fadeOut().animate({top:'-80px'},{queue:false, easing: 'swing', duration: 700}); 94 slider.slides.eq(slider.currentSlide).delay(500); 95 slider.slides.eq(slider.animatingTo).delay(500); 96 }, 97 after: function(slider) { 98 $('.hs-caption').fadeIn().animate({top:'0'},{queue:false, easing: 'swing', duration: 700}); 99 }, 100 useCSS: true 101 }); 102 } 103 104 /* ---------------------------------------------- /* 105 * Youtube video background 106 /* ---------------------------------------------- */ 107 108 $(function(){ 109 $(".video-player").mb_YTPlayer(); 110 }); 111 112 $('#video-play').click(function(event) { 113 event.preventDefault(); 114 if ($(this).hasClass('fa-play')) { 115 $('.video-player').playYTP(); 116 } else { 117 $('.video-player').pauseYTP(); 118 } 119 $(this).toggleClass('fa-play fa-pause'); 120 return false; 121 }); 122 123 $('#video-volume').click(function(event) { 124 event.preventDefault(); 125 $('.video-player').toggleVolume(); 126 $(this).toggleClass('fa-volume-off fa-volume-up'); 127 return false; 128 }); 129 130 /* ---------------------------------------------- /* 131 * Transparent navbar animation 132 /* ---------------------------------------------- */ 133 134 function navbarAnimation(navbar, homeSection, navHeight) { 135 136 var topScroll = $(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 } else { 144 navbar.removeClass('navbar-transparent'); 145 } 146 } 147 148 /* ---------------------------------------------- /* 149 * Navbar submenu 150 /* ---------------------------------------------- */ 151 152 function navbarSubmenu(width) { 153 if (width > 767) { 154 $('.navbar-custom .navbar-nav > li.menu-item-has-children').hover(function() { 155 var MenuLeftOffset = $('.sub-menu', $(this)).offset().left; 156 var Menu1LevelWidth = $('.sub-menu', $(this)).width();
157 if (width - MenuLeftOffset < Menu1LevelWidth * 2) { 158 $(this).children('.sub-menu').addClass('leftauto'); 159 } else { 160 $(this).children('.sub-menu').removeClass('leftauto'); 161 } 162 if ($('.menu-item-has-children', $(this)).length > 0) { 163 var Menu2LevelWidth = $('.sub-menu', $(this)).width(); 164 if (width - MenuLeftOffset - Menu1LevelWidth < Menu2LevelWidth) { 165 $(this).children('.sub-menu').addClass('left-side'); 166 } else { 167 $(this).children('.sub-menu').removeClass('left-side'); 168 } 169 } 170 }); 171 } 172 } 173 174 /* ---------------------------------------------- /* 175 * Navbar hover dropdown on desctop 176 /* ---------------------------------------------- */ 177 178 function hoverDropdown(width, mobileTest) { 179 if ((width > 767) && (mobileTest !== true)) { 180 $('.navbar-custom .navbar-nav > li, .navbar-custom li.dropdown > ul > li').removeClass('open'); 181 var delay = 0; 182 var setTimeoutConst; 183 $('.navbar-custom .navbar-nav > li, .navbar-custom li > ul > li').hover(function() { 184 var $this = $(this); 185 setTimeoutConst = setTimeout(function() { 186 $this.addClass('open'); 187 $this.find('.dropdown-toggle').addClass('disabled'); 188 }, delay); 189 }, 190 function() { 191 clearTimeout(setTimeoutConst); 192 $(this).removeClass('open'); 193 $(this).find('.dropdown-toggle').removeClass('disabled'); 194 }); 195 } else { 196 $('.navbar-custom .navbar-nav > li, .navbar-custom li > ul > li').unbind('mouseenter mouseleave'); 197 $('.navbar-custom [data-toggle=dropdown]').not('.binded').addClass('binded').on('click', function(event) { 198 event.preventDefault(); 199 event.stopPropagation(); 200 $(this).parent().siblings().removeClass('open'); 201 $(this).parent().siblings().find('[data-toggle=dropdown]').parent().removeClass('open'); 202 $(this).parent().toggleClass('open'); 203 }); 204 } 205 } 206 207 /* ---------------------------------------------- /* 208 * Navbar collapse on click 209 /* ---------------------------------------------- */ 210 211 $(document).on('click','.navbar-collapse.in',function(e) { 212 if( $(e.target).is('a') && $(e.target).attr('class') != 'dropdown-toggle' ) { 213 $(this).collapse('hide'); 214 } 215 }); 216 217 /* ---------------------------------------------- /* 218 * Set sections backgrounds 219 /* ---------------------------------------------- */ 220 221 var module = $('.home-section, .module, .module-small, .side-image'); 222 module.each(function(i) { 223 if ($(this).attr('data-background')) { 224 $(this).css('background-image', 'url(' + $(this).attr('data-background') + ')'); 225 } 226 }); 227 228 /* ---------------------------------------------- /* 229 * Testimonials, Post sliders 230 /* ---------------------------------------------- */ 231 232 if ($('.testimonials-slider').length > 0 ) { 233 $('.testimonials-slider').flexslider( { 234 animation: "slide", 235 smoothHeight: true, 236 }); 237 } 238 239 $('.post-images-slider').flexslider( { 240 animation: "slide", 241 smoothHeight: true, 242 }); 243 244 /* ---------------------------------------------- /* 245 * Owl slider 246 /* ---------------------------------------------- */ 247 248 $('.owl-carousel').each(function(i) { 249 250 // Check items number 251 if ($(this).data('items') > 0) { 252 items = $(this).data('items'); 253 } else { 254 items = 4; 255 } 256 257 // Check pagination true/false 258 if (($(this).data('pagination') > 0) && ($(this).data('pagination') === true)) { 259 pagination = true; 260 } else { 261 pagination = false; 262 } 263 264 // Check navigation true/false 265 if (($(this).data('navigation') > 0) && ($(this).data('navigation') === true)) { 266 navigation = true; 267 } else { 268 navigation = false; 269 } 270 271 // Build carousel 272 $(this).owlCarousel( { 273 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 274 navigation: navigation, 275 pagination: pagination, 276 paginationSpeed: 400, 277 singleItem: false, 278 items: items, 279 slideSpeed: 300, 280 autoPlay: 5000 281 }); 282 283 }); 284 285 /* ---------------------------------------------- /* 286 * Video popup, Gallery 287 /* ---------------------------------------------- */ 288 289 $('.video-pop-up').magnificPopup({ 290 type: 'iframe', 291 }); 292 293 $('a.gallery').magnificPopup({ 294 type: 'image', 295 gallery: { 296 enabled: true, 297 navigateByImgClick: true, 298 preload: [0,1] 299 }, 300 image: { 301 titleSrc: 'title', 302 tError: 'The image could not be loaded.', 303 } 304 }); 305 306 /* ---------------------------------------------- /* 307 * A jQuery plugin for fluid width video embeds 308 /* ---------------------------------------------- */ 309 310 $('body').fitVids(); 311 312 /* ---------------------------------------------- /* 313 * Open tabs by external link 314 /* ---------------------------------------------- */ 315 316 $('.open-tab').click(function (e) { 317 var pattern = /#.+/gi; 318 var contentID = e.target.toString().match(pattern)[0]; 319 $('.nav-tabs a[href="' + contentID + '"]').tab('show'); 320 }); 321 322 /* ---------------------------------------------- /* 323 * Scroll Animation 324 /* ---------------------------------------------- */ 325 326 $('.section-scroll').bind('click', function(e) { 327 var anchor = $(this); 328 $('html, body').stop().animate({ 329 scrollTop: $(anchor.attr('href')).offset().top - 50 330 }, 1000); 331 e.preventDefault(); 332 }); 333 334 /* ---------------------------------------------- /* 335 * Scroll top 336 /* ---------------------------------------------- */ 337 338 $(window).scroll(function() { 339 if ($(this).scrollTop() > 100) { 340 $('.scroll-up').fadeIn(); 341 } else { 342 $('.scroll-up').fadeOut(); 343 } 344 }); 345 346 $('a[href="#totop"]').click(function() { 347 $('html, body').animate({ scrollTop: 0 }, 'slow'); 348 return false;
349 }); 350 351 352 }); 353 354 $("#review_form form :input").each(function(index, elem) { 355 var eId = $(elem).attr("id"); 356 var label = null; 357 if (eId && (eId != 'subscribe_blog') && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) { 358 $(elem).attr("placeholder", $(label).text()); 359 $(label).remove(); 360 } 361 }); 362 363})(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.