1/*----------------------------------------------------------------------------------- 2 3 Script - All Custom frontend jQuery scripts & functions 4 5-----------------------------------------------------------------------------------*/ 6(function(){ 7'use strict'; 8 9/*---------------------------------------------- 10 SCROLL TO ANCHOR LINK 11------------------------------------------------*/ 12$('a[href^="#"]').on('click', function () { 13 var target = $(this.hash); 14 if( target.length ) { 15 event.preventDefault(); 16 $('html, body').stop().animate({ 17 scrollTop: target.offset().top 18 }, 500); 19 } 20}); 21 22/* do animations if element is visible 23------------------------------------------------*/ 24function animateOnScroll() { 25 if (jQuery("[class*='do-anim']").length > 0) { 26 jQuery("[class*='do-anim']").not('.animated') 27 .filter(function(i, d) { 28 return jQuery(d).visible(true); 29 }).each(function(i) { 30 var thisItem = jQuery(this); 31 var delayMulti = 200; 32 if (thisItem.hasClass("do-anim-modern")) { delayMulti = 10; } 33 var delay = i*delayMulti + 100; // + 150 is to add a small delay 34 thisItem.delay(delay).queue(function(){thisItem.addClass('animated');}); 35 }); 36 } 37} 38 39/* get current scroll position 40------------------------------------------------*/ 41function getCurrentScroll() { 42 return window.pageYOffset || document.documentElement.scrollTop; 43} 44 45/* pin anchor navigation bar 46------------------------------------------------*/ 47function pinNavAnchor() { 48 var scroll = getCurrentScroll(); 49 var heroHeight = $('#hero').outerHeight(); 50 if ( scroll >= heroHeight) { 51 $('#nav-anchor').addClass('pinned'); 52 } else { 53 $('#nav-anchor').removeClass('pinned'); 54 } 55} 56 57/*---------------------------------------------- 58 ANCHOR LINK NAVIGATION BAR 59------------------------------------------------*/ 60$('#nav-anchor a[href^="#"]').on('click', function () { 61 $('a').each(function () { 62 $(this).removeClass('active'); 63 }); 64 $(this).addClass('active'); 65 var target = $(this.hash); 66 var headerHeight = $('#header').outerHeight(); 67 var anchorHeight = $('#nav-anchor').outerHeight(); 68 if( target.length ) { 69 event.preventDefault(); 70 var windowWidth = $( window ).width(); 71 if(windowWidth >= 992) { 72 $('html, body').stop().animate({ 73 scrollTop: target.offset().top - (anchorHeight - 1) 74 }, 500); 75 } else { 76 $('html, body').stop().animate({ 77 scrollTop: target.offset().top - (headerHeight + anchorHeight - 1) 78 }, 500); 79 } 80 } 81}); 82 83$('.menu-anchor-sidebar a[href^="#"]').on('click', function () { 84 $('a').each(function () { 85 $(this).removeClass('active'); 86 }); 87 $(this).addClass('active'); 88 var target = $(this.hash); 89 var headerHeight = $('#header').outerHeight(); 90 var anchorHeight = $('#nav-anchor').outerHeight(); 91 if( target.length ) { 92 event.preventDefault(); 93 var windowWidth = $( window ).width(); 94 if(windowWidth >= 992) { 95 $('html, body').stop().animate({ 96 scrollTop: target.offset().top - (anchorHeight - 1) 97 }, 500); 98 } else { 99 $('html, body').stop().animate({ 100 scrollTop: target.offset().top - (headerHeight + anchorHeight - 1) 101 }, 500); 102 } 103 104 } 105}); 106 107/* do active menu 108------------------------------------------------*/ 109function activeMenuOnScroll() { 110 111 var scrollPosition = $(document).scrollTop(); 112 113 $('#nav-anchor a[href^="#"]').each(function () { 114 var currentLink = $(this); 115 var windowWidth = $( window ).width(); 116 var headerHeight = $('header').outerHeight(); 117 var anchorHeight = $('#nav-anchor').outerHeight(); 118 if(windowWidth >= 992) { 119 var secTop = $(currentLink.attr("href")).offset().top - anchorHeight -1, 120 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 121 } else { 122 var secTop = $(currentLink.attr("href")).offset().top - anchorHeight - headerHeight -1, 123 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 124 } 125 if (scrollPosition >= secTop && scrollPosition <= secBottom) { 126 $('#nav-anchor a').removeClass("active"); 127 $(this).addClass('active'); 128 $('#nav-anchor a').find('a[href="#'+$(this).attr('id')+'"]').addClass('active'); 129 } else { 130 $(this).removeClass('active'); 131 } 132 }); 133 134 $('.menu-anchor-sidebar a[href^="#"]').each(function () { 135 var currentLink = $(this); 136 var windowWidth = $( window ).width(); 137 var headerHeight = $('header').outerHeight(); 138 var anchorHeight = $('#nav-anchor').outerHeight(); 139 if(windowWidth >= 992) { 140 var secTop = $(currentLink.attr("href")).offset().top - anchorHeight -1, 141 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 142 } else { 143 var secTop = $(currentLink.attr("href")).offset().top - anchorHeight - headerHeight -1, 144 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 145 } 146 if (scrollPosition >= secTop && scrollPosition <= secBottom) { 147 $('.menu-anchor-sidebar a').removeClass("active"); 148 $(this).addClass('active'); 149 $('.menu-anchor-sidebar a').find('a[href="#'+$(this).attr('id')+'"]').addClass('active'); 150 } else { 151 $(this).removeClass('active'); 152 } 153 }); 154 155} 156 157 158/* header Features () 159------------------------------------------------*/ 160function headerFeatures() { 161 162} 163 164 165/* misc features which need to be regenerated on resize 166------------------------------------------------*/ 167function resizeAdapt() { 168 169 /*---------------------------------------------- 170 Sticky 171 ------------------------------------------------*/ 172 if ($('.sticky-outer').length) { 173 var stickySidebar = new StickySidebar('.sticky-outer', { 174 topSpacing: 80, 175 bottomSpacing: 50, 176 containerSelector: '.sticky-wrapper', 177 innerWrapperSelector: '.sticky-inner', 178 minWidth: 992 179 }); 180 } 181 182} 183 184/* isotope load more function 185------------------------------------------------*/ 186function isotopeLoadMore(grid,el,url,datas) { 187 188 el.parent(".load-isotope").addClass('loading'); 189 190 if (url === '#' || !url) { url = srvars.ajaxurl } 191 var addData = ''; if (datas) { addData = { action:'sr_load_more', o:datas }; } 192 jQuery.ajax({ 193 type:'POST', // this might lead to issues for html template 194 url:url, 195 data: addData, 196 dataType:"html", 197 error: function () { 198 el.parent(".load-isotope").addClass("disabled"); 199 }, 200 success: function(response) { 201 //console.log(response); 202 if (response) { 203 204 // if hero-side and sticky 205 if (jQuery("#hero.sticky_bottom[class*='side-']").length) { 206 var position = jQuery("#hero").position(); 207 var parentHeight = jQuery("#hero").parent().outerHeight(); 208 var scroll = jQuery(document).scrollTop(); 209 var addOffset = jQuery(window).height() - (parentHeight - scroll); 210 jQuery("#hero").css({"bottom":"auto", "top":position.top+addOffset+"px"}); 211 } 212 213 setTimeout(function(){ 214 var items = jQuery( jQuery(response).find('#'+grid.attr('id')).html()); 215 items.imagesLoaded(function(){ 216 grid.append( items ).isotope( 'appended', items); 217 //reorganizeIsotope();
218 animateOnScroll(false); 219 // init video bg for appended items 220 if(jQuery().phatVideoBg) { grid.find('.videobg-section').phatVideoBg(); } 221 }); 222 setTimeout(function(){ el.parent(".load-isotope").removeClass('loading'); }, 1000); 223 },500); 224 } else { 225 el.parent(".load-isotope").addClass("disabled"); 226 } 227 } 228 }); 229 230} 231 232 233/* reorganize isotope for ratio 234------------------------------------------------*/ 235function reorganizeIsotope() { 236 jQuery('.isotope-grid[data-ratio]').each(function(){ 237 var $container = jQuery(this); 238 var width = $container.find(".isotope-item:not(.double-width)").width(); 239 var ratio = $container.data('ratio').split(':'); 240 ratio = ratio[1] / ratio[0]; 241 if (!ratio) { ratio = 0.8; } 242 var spacing = 0; 243 if ($container.hasClass("isotope-spaced") || $container.hasClass("isotope-spaced-big")) { 244 spacing = parseInt($container.find(".isotope-item").css('marginRight'),10); 245 } 246 var height = parseInt(width * ratio, 10); 247 if (!$container.find('.isotope-item img:not(.hover)').parent(".ratio-wrapper").length) { 248 $container.find('.isotope-item img:not(.hover)').wrap('<div class="ratio-wrapper"></div>'); 249 } 250 $container.find('.isotope-item .ratio-wrapper').css({ 'height': height+'px' }); 251 if (jQuery(window).width() > 1024) { $container.find('.isotope-item.double-height .ratio-wrapper').css({ 'height': height*2+spacing+'px' }); } 252 $container.isotope( 'layout' ); 253 254 }); 255} 256 257/*---------------------------------------------- 258 S M O O T H S H O W (pageloader) 259------------------------------------------------*/ 260jQuery("body").addClass("loaded"); 261setTimeout(function(){ 262 setTimeout(function(){ animateOnScroll(true); },500); 263 headerFeatures(); 264}, 500); 265setTimeout(function(){ 266 jQuery("body").addClass("loading-end"); 267}, 1000); 268 269function toggleMenu() { 270 closeSearch(); 271 $('#header').toggleClass('menu-is-open'); 272 return false; 273} 274$('.menu-toggle').on('click', toggleMenu); 275 276function closeMenu() { 277 $('#header').removeClass('menu-is-open'); 278 return false; 279} 280$('.pseudo-close').on('click', closeMenu); 281 282function toggleSearch() { 283 closeMenu(); 284 if ( $('.searchsite-container').hasClass('searchsite-is-open') ) { 285 $('.searchsite-container').removeClass('searchsite-is-open'); 286 } else { 287 $('.searchsite-container').addClass('searchsite-is-open'); 288 $('.searchsite-input').focus(); 289 } 290 return false; 291} 292$('.searchsite-toggle').on('click', toggleSearch); 293 294function closeSearch() { 295 $('.searchsite-container').removeClass('searchsite-is-open'); 296 $('.searchsite-input').val(""); 297 $('.searchsite-input').blur(); 298 return false; 299} 300$('#searchsite-close').on('click', closeSearch); 301 302$(window).on('keyup', function(event) { 303 if ( $('#header').hasClass('menu-is-open') ) { 304 if ( event.keyCode === 27 ) { 305 closeMenu(); 306 } 307 } 308 if ( $('.searchsite-container').hasClass('searchsite-is-open') ) { 309 if ( event.keyCode === 27 ) { 310 closeSearch(); 311 } 312 } 313 return false; 314}); 315 316/*---------------------------------------------- 317 on Document Ready 318------------------------------------------------*/ 319jQuery( document ).ready(function() { 320 321 if( $('#hero').hasClass('text-light') ) { $('#logo-move').addClass('logo-light'); } else { $('#logo-move').removeClass('logo-light'); } 322 323}); 324 325 326jQuery(window).on("load",function() { 327 328 329 /*---------------------------------------------- 330 L A Z Y L O A D 331 ------------------------------------------------*/ 332 if(jQuery().unveil && jQuery("img.lazy").length > 0) { 333 jQuery("img.lazy").unveil(800); 334 } 335 336 337 /*---------------------------------------------- 338 I S O T O P E / M A S O N R Y 339 ------------------------------------------------*/ 340 if( jQuery().isotope ) { 341 342 /* Call Isotope 343 ------------------------------------------------*/ 344 jQuery('.isotope-grid').each(function(){ 345 var $container = jQuery(this); 346 var layout = "masonry"; 347 if ($container.hasClass("fitrows")) { layout = "fitRows"; } 348 $container.imagesLoaded( function(){ 349 $container.isotope({ 350 layoutMode: layout, 351 itemSelector : '.isotope-item', 352 masonry: { columnWidth: '.isotope-item:not(.double-width)' } 353 }); 354 }); 355 setTimeout(function() { $container.isotope( 'layout' ); reorganizeIsotope(); }, 500); 356 }); 357 358 jQuery('.grid-inner').each(function(){ 359 var $container = jQuery(this); 360 var layout = "masonry"; 361 if ($container.hasClass("fitrows")) { layout = "fitRows"; } 362 $container.imagesLoaded( function(){ 363 $container.isotope({ 364 layoutMode: layout, 365 itemSelector : '.grid-item', 366 masonry: { columnWidth: '.grid-sizer' } 367 }); 368 }); 369 setTimeout(function() { $container.isotope( 'layout' ); reorganizeIsotope(); }, 500); 370 }); 371 372 373 374 /* Filter isotope 375 ------------------------------------------------*/ 376 jQuery('.grid-filter').on("click", "li a", function() { 377 var thisItem = jQuery(this); 378 var parentul = thisItem.parents('ul.grid-filter').data('related-grid'); 379 if (!parentul) { 380 alert('Please specify the dala-related-grid'); 381 } else { 382 thisItem.parents('ul.grid-filter').find('li').removeClass('active'); 383 thisItem.parent('li').addClass('active'); 384 var selector = thisItem.attr('data-filter'); 385 jQuery('#'+parentul).isotope({ filter: selector }); 386 jQuery('#'+parentul+' .isotope-item .item-inner').not(selector).removeClass("animated"); 387 setTimeout(function() { jQuery('#'+parentul+' .isotope-item'+selector+' .item-inner').addClass("animated"); },200);
388 389 // adding slug hashtag to url 390 var slug = thisItem.data('slug'); 391 if (slug) { 392 window.location.hash = slug; } 393 else { 394 history.pushState("", document.title, window.location.pathname + window.location.search); 395 } 396 } 397 return false; 398 }); 399 400 } 401 402 /*---------------------------------------------- 403 O W L S L I D E R & C A R O U S E L 404 ------------------------------------------------*/ 405 if(jQuery().owlCarousel) { 406 407 $(".carousel-hero").owlCarousel({ 408 loop:true, 409 items:1, 410 margin:0, 411 nav:true, 412 dots:false, 413 autoplay:true, 414 autoplayTimeout:15000, 415 smartSpeed: 500, 416 autoplayHoverPause:true, 417 autoHeight:true, 418 navText: [ 419 '<i class="fas fa-angle-left"></i>', 420 '<i class="fas fa-angle-right"></i>' 421 ], 422 }); 423 424 $(".carousel-features").owlCarousel({ 425 loop:true, 426 items:1, 427 margin:0, 428 nav:true, 429 dots:false, 430 autoplay:true, 431 autoplayTimeout:15000, 432 smartSpeed: 500, 433 autoplayHoverPause:true, 434 autoHeight:true, 435 navText: [ 436 '<i class="fas fa-angle-left"></i>', 437 '<i class="fas fa-angle-right"></i>' 438 ], 439 lazyLoad:true, 440 responsive:{ 441 576:{ 442 items:2, 443 margin:1, 444 }, 445 1200:{ 446 items:3, 447 margin:1, 448 }, 449 }, 450 }); 451 452 $(".carousel-academic").owlCarousel({ 453 loop:true, 454 autoHeight:true, 455 margin:1, 456 nav:true, 457 dots:false, 458 autoplayTimeout:10000, 459 autoplayHoverPause:true, 460 responsiveClass:true, 461 responsive:{ 462 0:{ 463 items:1, 464 autoplay:false, 465 }, 466 576:{ 467 items:2, 468 autoplay:false, 469 }, 470 992:{ 471 items:3, 472 autoplay:true, 473 }, 474 1440:{ 475 items:4, 476 autoplay:true, 477 }, 478 }, 479 navText: [ 480 '<i class="fas fa-long-arrow-alt-left"></i>', 481 '<i class="fas fa-long-arrow-alt-right"></i>' 482 ], 483 lazyLoad:true, 484 onInitialized: function(me){ 485 $(me.target).find(".owl-item.active [data-src]:not(.loaded)").each(function(i,v){ 486 $(v).addClass("loaded").css("background-image", "url("+$(v).attr("data-src")+")"); 487 }); 488 }, 489 onTranslated: function(me){ 490 $(me.target).find(".owl-item.active [data-src]:not(.loaded)").each(function(i,v){ 491 $(v).addClass("loaded").css("background-image", "url("+$(v).attr("data-src")+")"); 492 }); 493 } 494 }); 495 496 $(".carousel-impact").owlCarousel({ 497 loop:true, 498 autoHeight:true, 499 margin:1, 500 nav:true, 501 dots:false, 502 autoplayTimeout:10000, 503 autoplayHoverPause:true, 504 responsiveClass:true, 505 responsive:{ 506 0:{ 507 items:1, 508 autoplay:false, 509 }, 510 576:{ 511 items:2, 512 autoplay:false, 513 margin:15, 514 }, 515 992:{ 516 items:3, 517 autoplay:true, 518 margin:15, 519 }, 520 1440:{ 521 items:4, 522 autoplay:true, 523 margin:30, 524 }, 525 }, 526 navText: [ 527 '<i class="fas fa-long-arrow-alt-left"></i>', 528 '<i class="fas fa-long-arrow-alt-right"></i>' 529 ], 530 lazyLoad:true, 531 onInitialized: function(me){ 532 $(me.target).find(".owl-item.active [data-src]:not(.loaded)").each(function(i,v){ 533 $(v).addClass("loaded").css("background-image", "url("+$(v).attr("data-src")+")"); 534 }); 535 }, 536 onTranslated: function(me){ 537 $(me.target).find(".owl-item.active [data-src]:not(.loaded)").each(function(i,v){ 538 $(v).addClass("loaded").css("background-image", "url("+$(v).attr("data-src")+")"); 539 }); 540 } 541 }); 542 543 $(".carousel-banner").owlCarousel({ 544 loop:true, 545 items:1, 546 margin:0, 547 nav:true, 548 dots:false, 549 autoplay: true, 550 autoplayTimeout: 15000, 551 smartSpeed: 750, 552 autoplayHoverPause: true, 553 autoHeight: true, 554 navText: [ 555 '<i class="fas fa-angle-left"></i>', 556 '<i class="fas fa-angle-right"></i>' 557 ], 558 responsive:{ 559 576:{ 560 items:2, 561 margin:1 562 }, 563 992:{ 564 items:3, 565 margin:1, 566 }, 567 }, 568 lazyLoad:true, 569 }); 570 571 jQuery(".owl-slider").owlCarousel({ 572 items:1, 573 nav: false, 574 navText:false, 575 dots: true, 576 smartSpeed : 600, 577 singleItem : true, 578 autoHeight : true, 579 loop: false, 580 autoplay: false, 581 autoplayHoverPause : true, 582 navRewind: false 583 }); 584 585 586 jQuery('.faculty-slider').owlCarousel({ 587 items: 1, 588 loop: true, 589 autoHeight: true, 590 margin: 0, 591 nav: true, 592 autoplay: false, 593 autoplayTimeout: 7500, 594 smartSpeed: 500, 595 autoplayHoverPause: true, 596 lazyLoad: true, 597 navText: [ 598 '<i class="fas fa-long-arrow-alt-left"></i>', 599 '<i class="fas fa-long-arrow-alt-right"></i>' 600 ], 601 responsive:{ 602 768: { items: 2, margin: 1, autoplay: false }, 603 992: { items: 2, margin: 1, autoplay: true }, 604 1200: { items: 3, margin: 1, autoplay: true }, 605 1920: { items: 4, margin: 1, autoplay: true }, 606 } 607 }); 608 609 } 610 611 /*============================================================== 612 Dropdown category menu 613 ==============================================================*/ 614 function DropDown(el) { 615 this.dd = el; 616 this.initEvents(); 617 } 618 DropDown.prototype = { 619 initEvents : function() { 620 var obj = this; 621 obj.dd.on('click', function(event){ 622 jQuery(this).toggleClass('active'); 623 event.stopPropagation(); 624 }); 625 } 626 }; 627 jQuery(function() { 628 var dd = new DropDown( jQuery('#dd') ); 629 jQuery(document).click(function() { 630 jQuery('.wrapper-dropdown').removeClass('active'); 631 }); 632 }); 633 /*---------------------------------------------- 634 T O G G L E & A C C O R D I O N 635 ------------------------------------------------*/ 636 jQuery(".toggle-item").each(function() { 637 if (!jQuery(this).find('.toggle-active').length) { jQuery(this).find('.toggle-inner').slideUp(300); } 638 jQuery(this).find('.toggle-active').parent(".toggle-item").siblings('.toggle-item').find('.toggle-inner').slideUp(300); 639 jQuery(this).find('.toggle-active').siblings('.toggle-inner').slideDown(300); 640 }); 641 642 jQuery(".toggle-item").on("click", ".toggle-title", function() { 643 var thisItem = jQuery(this); 644 var parentdiv = thisItem.parent('div').parent('div'); 645 var active = thisItem.parent('div').find('.toggle-inner').css('display'); 646 647 if (jQuery(parentdiv).attr('class') === 'accordion') { 648 if (active !== 'none' ) { 649 jQuery(parentdiv).find('.toggle-item .toggle-inner').slideUp(300); 650 thisItem.toggleClass('toggle-active'); 651 } else { 652 jQuery(parentdiv).find('.toggle-item .toggle-inner').slideUp(300); 653 jQuery(parentdiv).find('.toggle-item .toggle-title').removeClass('toggle-active'); 654 655 thisItem.toggleClass('toggle-active'); 656 thisItem.siblings('.toggle-inner').slideDown(300); 657 } 658 } else { 659 thisItem.toggleClass('toggle-active'); 660 thisItem.siblings('.toggle-inner').slideToggle(300); 661 } 662 663 return false; 664 }); 665 666 667 /*------------------------------------------------------- 668 S C R O L L T O (back to top, scroll down) 669 ---------------------------------------------------------*/ 670 jQuery('body').on('click', '.totop,#scrolldown', function() { 671 var topPos = 0; 672 if (jQuery(this).attr("id") === "scrolldown") { topPos = jQuery("#page-body").offset().top; } 673 jQuery('html,body').animate({ scrollTop: topPos}, 1000, 'easeInOutQuart'); 674 return false; 675 }); 676 677 /*------------------------------------------------------- 678 L A N G U A G E - C L I C K (responsive) 679 ---------------------------------------------------------*/ 680 jQuery('body').on('click', '.language-icon', function() { 681 jQuery('header').toggleClass("language-active"); 682 return false; 683 }); 684 685 /*============================================================== 686 lightbox gallery 687 ==============================================================*/ 688 $('.lightbox-gallery').magnificPopup({ 689 delegate: 'a', 690 type: 'image', 691 tLoading: 'Loading image #%curr%...', 692 mainClass: 'mfp-fade', 693 fixedContentPos: true, 694 closeBtnInside: true, 695 gallery: { 696 enabled: true, 697 navigateByImgClick: true, 698 preload: [0, 1] // Will preload 0 - before current, and 1 after the current image 699 } 700 }); 701 702 /*============================================================== 703 single image lightbox - zoom animation 704 ==============================================================*/ 705 $('.single-image-lightbox').magnificPopup({ 706 type: 'image', 707 closeOnContentClick: true, 708 fixedContentPos: true, 709 closeBtnInside: true, 710 mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side 711 image: { 712 verticalFit: true, 713 }, 714 zoom: { 715 enabled: true, 716 duration: 300 // don't foget to change the duration also in CSS 717 } 718 }); 719 720 $('.image-popup-vertical-fit').magnificPopup({ 721 type: 'image', 722 closeOnContentClick: true, 723 mainClass: 'mfp-img-mobile', 724 image: { 725 verticalFit: true 726 } 727 }); 728 729 /*============================================================== 730 video magnific popup 731 ==============================================================*/ 732 $('.popup-embed, .popup-youtube, .popup-vimeo, .popup-googlemap').magnificPopup({ 733 disableOn: 300, 734 type: 'iframe', 735 mainClass: 'mfp-fade', 736 removalDelay: 160, 737 preloader: false, 738 fixedContentPos: true 739 }); 740 741 resizeAdapt(); 742 743 /* 744 $('a[href^="#"]').on('click', function () { 745 746 //var target = $(this.getAttribute('href')); 747 var target = $(this.hash); 748 if( target.length ) { 749 event.preventDefault(); 750 $('html, body').stop().animate({ 751 scrollTop: target.offset().top 752 }, 500); 753 } 754 }); 755 756 $('nav.cf a[href^="#"]').on('click', function () { 757 $('a').each(function () { 758 $(this).removeClass('active'); 759 }); 760 $(this).addClass('active'); 761 //var target = $(this.getAttribute('href')); 762 var target = $(this.hash); 763 if( target.length ) { 764 event.preventDefault(); 765 var windowWidth = $( window ).width(); 766 if(windowWidth >= 992) { 767 $('html, body').stop().animate({ 768 scrollTop: target.offset().top - 79
769 }, 500); 770 } else { 771 console.log(target.offset().top); 772 $('html, body').stop().animate({ 773 scrollTop: target.offset().top - 89 774 }, 500); 775 } 776 777 } 778 }); 779 780 $(function() { 781 var menu = $('nav.cf ul.cf'); 782 $('#openup').on('click', function(e) { 783 e.preventDefault(); menu.slideToggle(); 784 }); 785 $(window).resize(function(){ 786 var w = $(this).width(); 787 if(w >= 992 && menu.is(':hidden')) { 788 menu.removeAttr('style'); 789 } 790 }); 791 $('nav li').on('click', function() { 792 var w = $(window).width(); 793 if(w < 992 ) { 794 menu.slideToggle(); 795 } 796 }); 797 $('.open-menu').height($(window).height()); 798 }); 799 */ 800 801 802 /* 803 $('.menu-item-has-children').children('a').on('click', function(event){ 804 event.preventDefault(); 805 $(this).toggleClass('submenu-open').next('.sub-menu').slideToggle(400, "easeInOutCubic").end().parent('.menu-item-has-children').siblings('.menu-item-has-children').children('a').removeClass('submenu-open').next('.sub-menu').slideUp(400, "easeInOutCubic"); 806 }); 807 */ 808 $('.menu-item-has-children').children('a').on('click', function(event){ 809 event.preventDefault(); 810 $(this).toggleClass('submenu-open').next('.sub-menu').slideToggle(400, "easeInOutCubic").parent('.menu-item-has-children').toggleClass('menu-item-has-children-open').end().parent('.menu-item-has-children').siblings('.menu-item-has-children').children('a').removeClass('submenu-open').next('.sub-menu').slideUp(400, "easeInOutCubic").parent('.menu-item-has-children').removeClass('menu-item-has-children-open'); 811 }); 812 813 $('.list-toggle li').children('.list-toggle-title').on('click', function(event){ 814 event.preventDefault(); 815 $(this).parent('.list-toggle li').toggleClass('active').end().parent('.list-toggle li').siblings('.list-toggle li').children('.list-toggle-title').parent('.list-toggle li').removeClass('active'); 816 }); 817 818 819 820 821 822 823 824 825}); 826 827jQuery(window).on('scroll',function() { 828 animateOnScroll(false); 829 headerFeatures(); 830 //onScroll(); 831 pinNavAnchor(); 832 activeMenuOnScroll(); 833 834 /* 835 var scroll = getCurrentScroll(); 836 var heroHeight = $('#hero').outerHeight() - 1; 837 if ( scroll >= heroHeight) { 838 $('nav.cf').addClass('cf-pinned'); 839 } else { 840 $('nav.cf').removeClass('cf-pinned'); 841 } 842 843 function onScroll(){ 844 var scrollPosition = $(document).scrollTop(); 845 846 $('nav.cf.anchor ul.cf a').each(function () { 847 var currentLink = $(this); 848 var windowWidth = $( window ).width(); 849 var headerHeight = $('header').outerHeight(); 850 var nav_height = $('nav.cf').outerHeight(); 851 if(windowWidth >= 992) { 852 var secTop = $(currentLink.attr("href")).offset().top - nav_height, 853 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 854 } else { 855 var secTop = $(currentLink.attr("href")).offset().top - nav_height - headerHeight, 856 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 857 } 858 if (scrollPosition >= secTop && scrollPosition <= secBottom) { 859 $('nav.cf ul.cf a').removeClass("active"); 860 $(this).addClass('active'); 861 $('nav.cf ul.cf a').find('a[href="#'+$(this).attr('id')+'"]').addClass('active'); 862 863 } else { 864 $(this).removeClass('active'); 865 } 866 }); 867 868 $('.sidebar-menu a').each(function () { 869 var currentLink = $(this); 870 var secTop = $(currentLink.attr("href")).offset().top - 1, 871 secBottom = secTop + $(currentLink.attr("href")).outerHeight(); 872 if (scrollPosition >= secTop && scrollPosition <= secBottom) { 873 $('.sidebar-menu a').removeClass("active"); 874 $(this).addClass('active'); 875 $('.sidebar-menu a').find('a[href="#'+$(this).attr('id')+'"]').addClass('active'); 876 877 } else{ 878 $(this).removeClass('active'); 879 } 880 }); 881 882 } 883 884 885 function getCurrentScroll() { 886 return window.pageYOffset || document.documentElement.scrollTop; 887 } 888 */ 889 890}); 891 892jQuery(window).on('resize',function() { 893 894 reorganizeIsotope(); 895 resizeAdapt(); 896 897 equalheight('.equalheight'); 898 899}); 900 901 902$(window).on('load', function () { 903 $(window).resize(function() { 904 905 var windowHeight = $(window).height(); 906 var windowWidth = $(window).width(); 907 var headerHeight = $('header').outerHeight(); 908 var resizeTimer = null; 909 var viewPortBgMode = null; 910 var viewPortImgMode = null; 911 912 equalheight('.equalheight'); 913 914 if (windowWidth < 992) { 915 $(".hero-full").height(windowHeight - headerHeight); 916 $(".hero-full .carousel-hero").height(windowHeight - headerHeight); 917 $(".hero-full .hero-banner").height(windowHeight - headerHeight); 918 //$(".hero-full .owl-height").height(windowHeight - headerHeight); 919 920 //$(".hero-full .hero-media").height(windowHeight - headerHeight); 921 //$(".hero-full .hero-entry").height(windowHeight - headerHeight); 922 } else { 923 $(".hero-full").height(windowHeight); 924 $(".hero-full .carousel-hero").height(windowHeight); 925 $(".hero-full .hero-banner").height(windowHeight); 926 //$(".hero-full .owl-height").height(windowHeight); 927 //$(".hero-full .hero-media").height(windowHeight); 928 //$(".hero-full .hero-entry").height(windowHeight); 929 } 930 931 932 933 /*============================================================== 934 Responsive image 935 ==============================================================*/ 936 var changeBgMode = function() { 937 var checkedViewPort = null; 938 var $adaptiveBg = $('[data-bg-mobile]'); 939 if ( windowWidth > 991 ) { 940 checkedViewPort = 'desktop'; 941 } else { 942 checkedViewPort = 'mobile'; 943 } 944 if( viewPortBgMode !== checkedViewPort ) { 945 $adaptiveBg.each(function() { 946 var attr = $(this).attr('data-bg-'+ checkedViewPort); 947 if(typeof attr !== typeof undefined && attr !== false) { 948 $(this).css( 'background-image', 'url(' + attr + ')'); 949 } else { 950 $(this).css( 'background-image', 'url(' + $(this).attr('data-bg-mobile') + ')'); 951 } 952 }); 953 viewPortBgMode = checkedViewPort; 954 } 955 }; 956 957 var changeImageMode = function(){ 958 var checkedViewPort = null; 959 var $adaptiveImg = $('[data-img-mobile]'); 960 if ( windowWidth > 991 ) { 961 checkedViewPort = 'desktop'; 962 } else { 963 checkedViewPort = 'mobile'; 964 } 965 if( viewPortImgMode !== checkedViewPort ){ 966 $adaptiveImg.each(function(){ 967 var attr = $(this).attr('data-img-'+ checkedViewPort); 968 if(typeof attr !== typeof undefined && attr !== false) { 969 $(this).attr('src', attr); 970 } else { 971 $(this).attr('src', $(this).attr('data-img-mobile') ); 972 } 973 }); 974 viewPortImgMode = checkedViewPort; 975 } 976 }; 977 978 979 /*============================================================== 980 Parallax 981 ==============================================================*/ 982 var changeParallaxMode = function() { 983 if (windowWidth > 991 && !Modernizr.touchevents) { 984 985 // Enllax Plugin 986 //$(window).enllax();
987 988 //var rellax = new Rellax('.rellax'); 989 990 // Paralax Background 991 var moveBg = function(el,i) { 992 var wHeight = $(window).height(); 993 var elTop = $(el).offset().top; 994 var elHeight = $(el).innerHeight(); 995 if(elTop > wHeight) { 996 var elReachBottom = elTop - wHeight; 997 } else { 998 var elReachBottom = 0; 999 } 1000 var elReachTop = elTop + elHeight; 1001 $(window).scroll(function() { 1002 var wScroll = $(this).scrollTop(); 1003 var moveDistance = ( wScroll - elReachBottom )/i; 1004 if (( wScroll > elReachBottom ) && ( wScroll < elReachTop )) { 1005 $(el).css({"background-position-y":moveDistance, "background-attachment":"fixed"}); 1006 } 1007 }); 1008 }; 1009 var initParalaxBg = function() { 1010 $(".paralaxbg").each(function() { 1011 var x = $(this).attr("data-paralaxbg-speed"); 1012 if(x) { 1013 moveBg(this,x); 1014 } else { 1015 moveBg(this,20); 1016 } 1017 }); 1018 }; 1019 initParalaxBg(); 1020 1021 } 1022 }; 1023 1024 $(function(){ 1025 changeBgMode(); 1026 changeImageMode(); 1027 changeParallaxMode(); 1028 1029 $(window).on('resize',function(){ 1030 clearTimeout( resizeTimer ); 1031 resizeTimer = null; 1032 resizeTimer = setTimeout(function(){ 1033 changeBgMode(); 1034 changeImageMode(); 1035 changeParallaxMode(); 1036 },100); 1037 }); 1038 }); 1039 1040 1041 }).resize(); 1042}); 1043 1044 1045})(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.