1( function ($) { 2 3 'use strict'; 4 5 /* ---------------------------------------------- /* 6 * Preloader 7 /* ---------------------------------------------- */ 8 9 $(window).load( function () { 10 $('.loader').fadeOut(); 11 $('.page-loader').delay(350).fadeOut('slow'); 12 }); 13 14 $(document).ready( function () { 15 16 /* ---------------------------------------------- /* 17 * Initialization general scripts for all pages 18 /* ---------------------------------------------- */ 19 20 var moduleHero = $('#hero'), 21 overlayMenu = $('#overlay-menu'), 22 slider = $('#slides'), 23 navbar = $('.navbar-custom'), 24 filters = $('#filters'), 25 worksgrid = $('#works-grid'), 26 modules = $('.module-hero, .module, .module-small'), 27 windowWidth = Math.max($(window).width(), window.innerWidth), 28 navbatTrans, 29 mobileTest; 30 31 navbarCheck(navbar); 32 33 setModuleTileHeight(); 34 35 $(window).resize( function () { 36 windowWidth = Math.max($(window).width(), window.innerWidth); 37 buildModuleHero(); 38 setModuleTileHeight(); 39 }); 40 41 $(window).scroll( function () { 42 if(windowWidth > 960){ 43 navbarAnimation(navbar, moduleHero); 44 } 45 }).scroll(); 46 47 // preview 48 if($('.preview').length > 0){ 49 $('.preview').click( function (e) { 50 e.preventDefault(); 51 $('.panel-half-height').addClass('show-media'); 52 }); 53 } 54 55 /* ---------------------------------------------- /* 56 * Mobile detect 57 /* ---------------------------------------------- */ 58 59 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){ 60 mobileTest = true; 61 }else{ 62 mobileTest = false; 63 } 64 65 /* ---------------------------------------------- /* 66 * Intro slider setup 67 /* ---------------------------------------------- */ 68 69 var slidesContainer = '.module-half-height'; 70 if($('.module-full-height').length > 0){ 71 slidesContainer = '.module-full-height'; 72 } 73 74 $('#slides').superslides({ 75 play: 10000, 76 animation: 'fade',
77 animation_speed: 800, 78 pagination: true, 79 inherit_height_from: slidesContainer 80 }); 81 82 /* ---------------------------------------------- /* 83 * Setting background of modules 84 /* ---------------------------------------------- */ 85 86 modules.each( function () { 87 if($(this).attr('data-background')){ 88 $(this).css('background-image', 'url(' + $(this).attr('data-background') + ')'); 89 } 90 }); 91 92 /* ---------------------------------------------- /* 93 * Parallax 94 /* ---------------------------------------------- */ 95 96 if(mobileTest === true){ 97 $('.module-parallax').css({'background-attachment': 'scroll'}); 98 }else{ 99 $('#hero.module-parallax').parallax('50%', 0.2); 100 } 101 102 /* ---------------------------------------------- /* 103 * Set module tile height 104 /* ---------------------------------------------- */ 105 106 function setModuleTileHeight () { 107 if($('.module-tile').length > 0){ 108 if(windowWidth >= 768){ 109 var height = $(window).height() / 2; 110 $('.module-tile').css('height', height+'px'); 111 }else{ 112 $('.module-tile').css('height', ''); 113 } 114 } 115 } 116 117 /* ---------------------------------------------- /* 118 * Full height module 119 /* ---------------------------------------------- */ 120 121 function buildModuleHero () { 122 if(moduleHero.length > 0){ 123 if(moduleHero.hasClass('module-full-height')){ 124 moduleHero.height($(window).height()); 125 }else if(moduleHero.hasClass('module-half-height')){ 126 moduleHero.height($(window).height() / 2); 127 }else{ 128 moduleHero.height($(window).height() * 0.85); 129 } 130 } 131 } 132 133 /* ---------------------------------------------- /* 134 * Youtube video background 135 /* ---------------------------------------------- */ 136 137 $( function () { 138 $('.video-player').mb_YTPlayer(); 139 }); 140 141 /* ---------------------------------------------- /* 142 * Transparent navbar animation 143 /* ---------------------------------------------- */ 144 145 function navbarCheck () { 146 if(navbar.length > 0 && navbar.hasClass('navbar-transparent')){ 147 navbatTrans = true; 148 }else{ 149 navbatTrans = false; 150 } 151 } 152 153 function navbarAnimation (navbar, moduleHero) { 154 var topScroll = $(window).scrollTop(); 155 if(navbar.length > 0 && navbatTrans !== false){ 156 if(topScroll >= 5){ 157 navbar.removeClass('navbar-transparent'); 158 }else{ 159 navbar.addClass('navbar-transparent'); 160 } 161 } 162 } 163 164 /* ---------------------------------------------- /* 165 * Show/Hide overlay menu 166 /* ---------------------------------------------- */ 167 168 $('#toggle-menu').on('click', function () { 169 showMenu(); 170 $('body').addClass('aux-navigation-active'); 171 return false; 172 }); 173 174 $('#overlay-menu-hide').on('click', function () { 175 hideMenu(); 176 $('body').removeClass('aux-navigation-active'); 177 return false; 178 }); 179 180 $(window).keydown( function (e) { 181 if(overlayMenu.hasClass('active')){ 182 if(e.which === 27){ 183 hideMenu(); 184 } 185 } 186 }); 187 188 function showMenu () { 189 navbar.animate({'opacity': 0, 'top': -80}, { 190 duration: 150, 191 easing: 'easeInOutQuart' 192 }); 193 194 overlayMenu.addClass('active'); 195 } 196 197 function hideMenu () { 198 navbar.animate({'opacity': 1, 'top': 0}, { 199 duration: 150, 200 easing: 'easeInOutQuart' 201 }); 202 203 overlayMenu.removeClass('active'); 204 } 205 206 /* ---------------------------------------------- /* 207 * Overlay dropdown menu 208 /* ---------------------------------------------- */ 209 210 $('#nav > li.slidedown > a').on('click', function () { 211 if($(this).attr('class') != 'active'){ 212 $('#nav li ul').slideUp({duration: 300, easing: 'easeInOutQuart'}); 213 $('#nav li a').removeClass('active'); 214 $(this).next().slideToggle({duration: 300, easing: 'easeInOutQuart'}).addClass('open'); 215 $(this).addClass('active'); 216 }else{ 217 $('#nav li ul').slideUp({duration: 300, easing: 'easeInOutQuart'}).removeClass('open'); 218 $(this).removeClass('active'); 219 } 220 return false; 221 }); 222 223 /* ---------------------------------------------- /* 224 * Portfolio 225 /* ---------------------------------------------- */ 226 227 $('a', filters).on('click', function () { 228 var selector = $(this).attr('data-filter'); 229 230 $('.current', filters).removeClass('current'); 231 $(this).addClass('current'); 232 233 worksgrid.isotope({ 234 filter: selector 235 }); 236 237 return false;
238 }); 239 240 $(window).on('resize', function () { 241 242 var windowWidth = Math.max($(window).width(), window.innerWidth), 243 itemWidht = $('.grid-sizer').width(), 244 itemHeight = Math.floor(itemWidht * 0.95), 245 itemTallHeight = itemHeight * 2; 246 247 if(windowWidth > 500){ 248 $('.work-item', worksgrid).each( function () { 249 if($(this).hasClass('tall')){ 250 $(this).css({ 251 height : itemTallHeight 252 }); 253 }else if($(this).hasClass('wide')){ 254 $(this).css({ 255 height : itemHeight 256 }); 257 }else if($(this).hasClass('wide-tall')){ 258 $(this).css({ 259 height : itemTallHeight 260 }); 261 }else{ 262 $(this).css({ 263 height : itemHeight 264 }); 265 } 266 }); 267 }else{ 268 $('.work-item', worksgrid).each( function () { 269 if($(this).hasClass('tall')){ 270 $(this).css({ 271 height : itemTallHeight 272 }); 273 }else if($(this).hasClass('wide')){ 274 $(this).css({ 275 height : itemHeight / 2 276 }); 277 }else if($(this).hasClass('wide-tall')){ 278 $(this).css({ 279 height : itemHeight 280 }); 281 }else{ 282 $(this).css({ 283 height : itemHeight 284 }); 285 } 286 }); 287 } 288 289 worksgrid.imagesLoaded( function () { 290 worksgrid.isotope({ 291 layoutMode: 'packery', 292 itemSelector: '.work-item', 293 transitionDuration: '0.3s', 294 packery: { 295 columnWidth: '.grid-sizer', 296 }, 297 }); 298 }); 299 300 }).resize(); 301 302 /* ---------------------------------------------- /* 303 * Blog grid 304 /* ---------------------------------------------- */ 305 306 $('#posts-masonry').imagesLoaded( function () { 307 $('#posts-masonry').isotope({ 308 layoutMode: 'masonry', 309 transitionDuration: '0.3s' 310 }); 311 }); 312 313 /* ---------------------------------------------- /* 314 * Ajax options 315 /* ---------------------------------------------- */ 316 317 var ajaxOffset = 10, 318 ajaxLimit = 10; 319 320 var doneText = 'Done', 321 loadText = 'More works', 322 loadingText = 'Loading...', 323 errorText = 'Error!'; 324 325 /* ---------------------------------------------- /* 326 * Ajax portfolio 327 /* ---------------------------------------------- */ 328 329 $('#show-more').on('click', function (e) { 330 e.preventDefault(); 331 // more button 332 $(this).text(loadingText); 333 // ajax 334 setTimeout( function () { 335 ajaxLoadMore(); 336 }, 300); 337 }); 338 339 function ajaxLoadMore () { 340 $.ajax({ 341 type: 'GET', 342 dataType: 'html', 343 url: '/mike-cotty/embeds/ajax_load_more_works/'+ajaxOffset+'/'+ajaxLimit, 344 success: function (data) { 345 if($(data).find('.work-item').length > 0){ 346 var work = $(data).find('.work-item').slice(0); 347 worksgrid.append(work).isotope('appended', work).resize(); 348 ajaxOffset += ajaxLimit; 349 // more button 350 setTimeout( function () { 351 $('#show-more').text(loadText); 352 }, 300); 353 }else{ 354 // more button 355 setTimeout( function () { 356 $('#show-more').text(doneText); 357 }, 300); 358 setTimeout( function () { 359 $('#show-more').animate({ 360 opacity: 0, 361 }).css('display', 'none'); 362 }, 1500); 363 } 364 }, 365 error: function (jqXHR, textStatus, errorThrown) { 366 // more button 367 setTimeout( function () { 368 $('#show-more').removeClass('ss-loading').text(errorText); 369 }, 300); 370 } 371 }); 372 } 373 374 /* ---------------------------------------------- /* 375 * Rotate 376 /* ---------------------------------------------- */ 377 378 $('.rotate').textrotator({ 379 animation: 'dissolve', 380 separator: '|', 381 speed: 3000 382 }); 383 384 /* ---------------------------------------------- /* 385 * Owl sliders 386 /* ---------------------------------------------- */ 387 388 $('.slider-testimonials').owlCarousel({ 389 stopOnHover: !0, 390 singleItem: !0, 391 autoHeight: !0, 392 slideSpeed: 400, 393 paginationSpeed: 1000, 394 goToFirstSpeed: 2000, 395 autoPlay: 3000, 396 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'] 397 }); 398 399 $('.slider-images').owlCarousel({ 400 stopOnHover: !0, 401 singleItem: !0, 402 autoHeight: !0, 403 navigation: !0, 404 slideSpeed: 400, 405 paginationSpeed: 1000, 406 goToFirstSpeed: 2000, 407 autoPlay: 3000, 408 // transitionStyle : 'fade', 409 navigationText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'] 410 }); 411 412 /* ---------------------------------------------- /* 413 * Video popup, Gallery 414 /* ---------------------------------------------- */ 415 416 $('.video-pop-up').magnificPopup({ 417 type: 'iframe', 418 }); 419 420 $('a.gallery').magnificPopup({ 421 type: 'image', 422 gallery: { 423 enabled: true, 424 navigateByImgClick: true, 425 preload: [0,1] 426 }, 427 image: { 428 titleSrc: 'title', 429 tError: 'The image could not be loaded.', 430 } 431 }); 432 433 /* ---------------------------------------------- /* 434 * Progress bars, counters animations 435 /* ---------------------------------------------- */ 436 437 $('.progress-bar').each( function (i) { 438 $(this).appear( function () { 439 var percent = $(this).attr('aria-valuenow'); 440 $(this).animate({'width' : percent + '%'}); 441 $(this).find('span').animate({'opacity' : 1}, 900); 442 $(this).find('span').countTo({from: 0, to: percent, speed: 900, refreshInterval: 30}); 443 }); 444 }); 445 446 $('.counter-item').each( function (i) { 447 $(this).appear( function () { 448 var number = $(this).find('.counter-number').data('number'); 449 $(this).find('.counter-number span').countTo({from: 0, to: number, speed: 1200, refreshInterval: 30}); 450 }); 451 }); 452 453 /* ---------------------------------------------- /* 454 * WOW Animation 455 /* ---------------------------------------------- */ 456 457 var wow = new WOW({ 458 mobile: false 459 }); 460 461 wow.init(); 462 463 /* ---------------------------------------------- /* 464 * A jQuery plugin for fluid width video embeds 465 /* ---------------------------------------------- */ 466 467 $('body').fitVids(); 468 469 /* ---------------------------------------------- /* 470 * Scroll Animation 471 /* ---------------------------------------------- */ 472 473 $('.section-scroll').bind('click', function (e) { 474 var anchor = $(this); 475 476 $('html, body').stop().animate({ 477 scrollTop: $(anchor.attr('href')).offset().top 478 }, 1000); 479 480 e.preventDefault(); 481 }); 482 483 /* ---------------------------------------------- /* 484 * Scroll top 485 /* ---------------------------------------------- */ 486 487 $(window).scroll( function () { 488 if($(this).scrollTop() > 100){ 489 $('.scroll-up').fadeIn(); 490 }else{ 491 $('.scroll-up').fadeOut(); 492 } 493 }); 494 495 $('a[href="#totop"]').click( function () { 496 $('html, body').animate({ scrollTop: 0 }, 'slow'); 497 return false;
498 }); 499 500 }); 501 502})(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.