1/* ----------------------------------------------------------------------------- 2 3 TABLE OF CONTENTS 4 5 1.) General 6 2.) Components 7 3.) Header 8 4.) Core 9 5.) Widgets 10 6.) Main Sidebar 11 7.) Other 12 8.) Style Switcher 13 14----------------------------------------------------------------------------- */ 15 16(function($){ "use strict"; 17$(document).ready(function(){ 18 19/* ----------------------------------------------------------------------------- 20 21 1.) GENERAL 22 23----------------------------------------------------------------------------- */ 24 25 /* ------------------------------------------------------------------------- 26 AJAX FORMS 27 ------------------------------------------------------------------------- */ 28 29 if ( $.fn.lsvrAjaxForm ) { 30 $( 'form.m-ajax-form' ).each(function(){ 31 $(this).lsvrAjaxForm(); 32 }); 33 } 34 35 /* ------------------------------------------------------------------------- 36 AJAX MODAL 37 ------------------------------------------------------------------------- */ 38 39 if ( $.fn.lsvrOpenAjaxModal ) { 40 $( '.c-gallery a.m-open-ajax-modal' ).each(function(){ 41 $(this).lsvrOpenAjaxModal(); 42 }); 43 } 44 45 /* ------------------------------------------------------------------------- 46 FLUID MEDIA 47 ------------------------------------------------------------------------- */ 48 49 if ( $.fn.lsvrFluidEmbedMedia ){ 50 $( 'body' ).lsvrFluidEmbedMedia(); 51 } 52 53 /* ------------------------------------------------------------------------- 54 FORMS 55 ------------------------------------------------------------------------- */ 56 57 // CHECKBOX INPUTS 58 if ( $.fn.lsvrCheckboxInput ) { 59 $( '.checkbox-input' ).each(function(){ 60 $(this).lsvrCheckboxInput(); 61 }); 62 } 63 64 // RADIO INPUTS 65 if ( $.fn.lsvrRadioInput ) { 66 $( '.radio-input' ).each(function(){ 67 $(this).lsvrRadioInput(); 68 }); 69 } 70 71 // SELECTBOX INPUTS 72 if ( $.fn.lsvrSelectboxInput ) { 73 $( '.selectbox-input' ).each(function(){ 74 $(this).lsvrSelectboxInput(); 75 }); 76 } 77 78 // VALIDATE FORMS 79 if ( $.fn.lsvrIsFormValid ) { 80 $( 'form.m-validate' ).each(function(){ 81 var $this = $(this); 82 $this.submit(function(){ 83 if ( ! $this.lsvrIsFormValid() ) { 84 $this.find( '.m-validation-error' ).slideDown( 300 ); 85 return false; 86 } 87 }); 88 }); 89 } 90 91 /* ------------------------------------------------------------------------- 92 INPUT PLACEHOLDERS 93 ------------------------------------------------------------------------- */ 94 95 if ( $.fn.lsvrInputPlaceholder ) { 96 $( '*[data-placeholder]' ).each(function(){ 97 $(this).lsvrInputPlaceholder(); 98 }); 99 } 100 101 /* ------------------------------------------------------------------------- 102 INVIEW ANIMATION 103 ------------------------------------------------------------------------- */ 104 105 if ( $.fn.lsvrInviewAnimation ) { 106 $( '[data-inview-anim]' ).each( function(){ 107 $(this).addClass( 'visibility-hidden' ); 108 $(this).lsvrInviewAnimation(); 109 }); 110 } 111 112 /* ------------------------------------------------------------------------- 113 LIGHTBOXES 114 ------------------------------------------------------------------------- */ 115 116 if ( $.fn.lsvrInitLightboxes ) { 117 $( 'body' ).lsvrInitLightboxes(); 118 } 119 120 /* ------------------------------------------------------------------------- 121 LOAD HIRES IMAGES FOR HiDPI SCREENS 122 ------------------------------------------------------------------------- */ 123 124 if ( $.fn.lsvrLoadHiresImages ) { 125 $( 'body' ).lsvrLoadHiresImages(); 126 } 127 128 /* ------------------------------------------------------------------------- 129 MEDIA QUERY BREAKPOINT 130 ------------------------------------------------------------------------- */ 131 132 var mediaQueryBreakpoint; 133 if ( $.fn.lsvrGetMediaQueryBreakpoint ) { 134 mediaQueryBreakpoint = $.fn.lsvrGetMediaQueryBreakpoint(); 135 $( document ).on( 'screenTransition', function(){ 136 mediaQueryBreakpoint = $.fn.lsvrGetMediaQueryBreakpoint(); 137 }); 138 } 139 else { 140 mediaQueryBreakpoint = $(window).width(); 141 } 142 143 144/* ----------------------------------------------------------------------------- 145 146 2.) COMPONENTS 147 148----------------------------------------------------------------------------- */ 149 150 /* ------------------------------------------------------------------------- 151 ACCORDION 152 ------------------------------------------------------------------------- */ 153 154 if ( $.fn.lsvrAccordion ) { 155 $( '.c-accordion' ).each(function(){ 156 $(this).lsvrAccordion(); 157 }); 158 } 159 160 /* ------------------------------------------------------------------------- 161 ALERT MESSAGE 162 ------------------------------------------------------------------------- */ 163 164 if ( $.fn.lsvrAlertMessage ) { 165 $( '.c-alert-message ' ).each(function(){ 166 $(this).lsvrAlertMessage(); 167 }); 168 } 169 170 /* ------------------------------------------------------------------------- 171 BLOG 172 ------------------------------------------------------------------------- */ 173 174 // ISOTOPE 175 if ( $.fn.isotope && $.fn.lsvrImagesLoaded ) { 176 $( '.c-blog' ).each(function(){ 177 178 var $this = $(this), 179 itemList = $this.find( '.item-list' ).first(), 180 filter = $this.find( '.blog-filter' ).first(), 181 pagination = $this.find( '.c-pagination' ), 182 loadBtn = pagination.find( '.c-button' ); 183 184 // LOAD IMAGES 185 itemList.lsvrImagesLoaded(function(){ 186 187 // INIT ISOTOPE 188 itemList.isotope({ 189 itemSelector: 'article', 190 layoutMode: 'masonry', 191 }); 192 193 // INIT FILTER 194 filter.fadeIn( 300, function(){ 195 $(this).removeAttr( 'style' ).addClass( 'm-active' ); 196 }); 197 filter.on( 'click', 'button', function() { 198 var filterValue = $(this).attr( 'data-filter' ) ? $(this).attr( 'data-filter' ) : '*'; 199 itemList.isotope({ filter: filterValue });
200 filter.find( '.m-active' ).removeClass( 'm-active' ); 201 filter.find( '*[data-filter="' + filterValue + '"]' ).addClass( 'm-active' ); 202 }); 203 204 pagination.fadeIn( 300 ); 205 $this.addClass( 'm-images-loaded' ); 206 207 }); 208 209 // AJAXED PAGINATION 210 if ( pagination.hasClass( 'm-ajaxed' ) ) { 211 loadBtn.click(function(){ 212 if ( ! loadBtn.hasClass( 'm-loading' ) ) { 213 214 var url = loadBtn.attr( 'href' ) + ' #page-content', 215 label = loadBtn.html(), 216 loadingLabel = loadBtn.data( 'loading-label' ) ? loadBtn.data( 'loading-label' ) : 'Loading', 217 noMoreLabel = loadBtn.data( 'no-more-label' ) ? loadBtn.data( 'no-more-label' ) : 'No more posts'; 218 219 loadBtn.addClass( 'm-loading' ); 220 loadBtn.html( loadingLabel ); 221 222 // LOAD 223 $( 'body' ).append( '<div class="c-loading-container" style="display: none;"></div>' ); 224 var loadingContainer = $( '.c-loading-container' ).last(); 225 loadingContainer.load( url, function( response, status, xhr ){ 226 loadingContainer.lsvrImagesLoaded(function(){ 227 228 // ADD NEW ITEMS 229 var newItems = loadingContainer.find( '.blog-list > article' ); 230 itemList.append( newItems ).isotope( 'appended', newItems ); 231 232 // CHECK FOR PAGINATION 233 if ( loadingContainer.find( '.c-pagination .pagination-next' ).length > 0 || loadingContainer.find( '.c-pagination ul > li:last-child:not( .m-active )' ).length > 0 ) { 234 235 loadBtn.removeClass( 'm-loading' ).html( label ); 236 var newPagination; 237 if ( loadingContainer.find( '.c-pagination .pagination-next' ).length > 0 ) { 238 newPagination = loadingContainer.find( '.c-pagination .pagination-next' ); 239 } 240 else { 241 newPagination = loadingContainer.find( '.c-pagination ul > li:last-child:not( .m-active )' ); 242 } 243 if ( newPagination.length > 0 ) { 244 loadBtn.attr( 'href', newPagination.find( 'a' ).first().attr( 'href' ) ); 245 } 246 247 } 248 else { 249 250 loadBtn.html( noMoreLabel ); 251 252 // HIDE PAGINATION 253 $this.find( '.c-pagination' ).one( 'inview', function(){ 254 setTimeout(function(){ 255 $this.find( '.c-pagination' ).slideUp(300, function(){ 256 $(this).remove(); 257 }); 258 }, 3000); 259 }); 260 261 } 262 263 // REMOVE LOADING CONTAINER 264 loadingContainer.remove(); 265 266 // INIT LIGHTBOXES & FLUID MEDIA 267 if ( $.fn.lsvrInitLightboxes ) { 268 itemList.lsvrInitLightboxes(); 269 } 270 if ( $.fn.lsvrFluidEmbedMedia ){ 271 itemList.lsvrFluidEmbedMedia(); 272 } 273 274 // UPDATE ISOTOPE LAYOUT 275 itemList.isotope( 'layout' ); 276 277 }); 278 }); 279 280 } 281 return false; 282 }); 283 } 284 285 }); 286 } 287 288 /* ------------------------------------------------------------------------- 289 CAROUSEL 290 ------------------------------------------------------------------------- */ 291 292 if ( $.fn.lsvrCarousel ) { 293 $( '.c-carousel' ).each(function(){ 294 $(this).lsvrCarousel(); 295 }); 296 } 297 298 /* ------------------------------------------------------------------------- 299 COUNTER 300 ------------------------------------------------------------------------- */ 301 302 if ( $.fn.lsvrCounter ) { 303 $( '.c-counter' ).each(function(){ 304 $(this).lsvrCounter(); 305 }); 306 } 307 308 /* ------------------------------------------------------------------------- 309 GALLERY 310 ------------------------------------------------------------------------- */ 311 312 // OPEN MODAL WINDOW 313 var lsvrInitGalleryAjaxModals = function(){ 314 if ( $.fn.lsvrOpenAjaxModal ) { 315 $( '.c-gallery' ).each(function(){ 316 317 var $this = $(this), 318 galleryItems = $this.find( '.item-list > .item' ); 319 320 galleryItems.each(function(){ 321 322 var item = $(this), 323 index = item.index(); 324 325 item.find( 'a.m-open-ajax-modal-project' ).each(function(){ 326 327 var navigationObject = { 328 index: index, 329 galleryItems: galleryItems, 330 linkSelector: 'a.m-open-ajax-modal-project' 331 }; 332 333 $(this).lsvrOpenAjaxModal(function(){ 334 335 // CALLBACK FUNCTION FOR INIT PROJECT DETAILS 336 if ( typeof lsvrInitProjectDetail == 'function' ) { 337 lsvrInitProjectDetail( true ); 338 } 339 340 // INIT LIGHTBOXES 341 if ( $.fn.lsvrInitLightboxes ) { 342 $( '.c-modal' ).lsvrInitLightboxes(); 343 } 344 345 // INIT FLUID MEDIA 346 if ( $.fn.lsvrFluidEmbedMedia ){ 347 $( '.c-modal' ).lsvrFluidEmbedMedia();
348 } 349 350 // INIT INVIEW ANIMATIONS 351 if ( $.fn.lsvrInviewAnimation ) { 352 $( '.c-modal [data-inview-anim]' ).each( function(){ 353 $(this).addClass( 'visibility-hidden' ); 354 $(this).lsvrInviewAnimation(); 355 }); 356 } 357 358 // INIT HIRES IMAGES 359 if ( $.fn.lsvrLoadHiresImages ) { 360 $( '.c-modal' ).lsvrLoadHiresImages(); 361 } 362 363 // INIT ACCORDIONS 364 if ( $.fn.lsvrAccordion ) { 365 $( '.c-modal .c-accordion' ).each(function(){ 366 $(this).lsvrAccordion(); 367 }); 368 } 369 370 // INIT ALERT MESSAGES 371 if ( $.fn.lsvrAlertMessage ) { 372 $( '.c-modal .c-alert-message' ).each(function(){ 373 $(this).lsvrAlertMessage(); 374 }); 375 } 376 377 // INIT CAROUSELS 378 if ( $.fn.lsvrCarousel ) { 379 $( '.c-modal .c-carousel' ).each(function(){ 380 $(this).lsvrCarousel(); 381 }); 382 } 383 384 // INIT COUNTERS 385 if ( $.fn.lsvrCounter ) { 386 $( '.c-modal .c-counter' ).each(function(){ 387 $(this).lsvrCounter(); 388 });
389 } 390 391 // INIT GOOGLE MAP 392 if ( $.fn.lsvrLoadGoogleMaps && $( '.c-modal .c-gmap' ).length > 0 ) { 393 $.fn.lsvrLoadGoogleMaps(); 394 } 395 396 // INIT PROGRESS BARS 397 if ( $.fn.lsvrProgressBar ) { 398 $( '.c-modal .c-progress-bar' ).each(function(){ 399 $(this).lsvrProgressBar(); 400 }); 401 } 402 403 // INIT TABS 404 if ( $.fn.lsvrTabs ) { 405 $( '.c-modal .c-tabs' ).each(function(){ 406 $(this).lsvrTabs(); 407 }); 408 } 409 410 }, navigationObject ); 411 }); 412 413 }); 414 415 }); 416 417 } 418 }; 419 lsvrInitGalleryAjaxModals(); 420 421 // ISOTOPE 422 if ( $.fn.isotope && $.fn.lsvrImagesLoaded ) { 423 $( '.c-gallery' ).each(function(){ 424 425 var $this = $(this), 426 itemListContainer = $this.find( '.item-list-container' ), 427 itemList = $this.find( '.item-list' ), 428 filter = $this.find( '.gallery-filter' ), 429 layout = itemList.data( 'layout' ) ? itemList.data( 'layout' ) : 'fitRows'; 430 431 // CREATE FILTER COPY 432 if ( itemListContainer.prev( '.gallery-tools' ).length < 1 ) { 433 filter.clone().prependTo( $this ).wrap( '<div class="gallery-tools-top"><div class="container"></div></div>' ); 434 filter = $this.find( '.gallery-filter' ); 435 $this.addClass( 'm-has-gallery-tools-top' ); 436 } 437 438 // LOAD IMAGES 439 itemList.lsvrImagesLoaded(function(){ 440 441 // INIT ISOTOPE 442 itemList.isotope({ 443 itemSelector: '.item', 444 layoutMode: layout, 445 }); 446 447 // INIT FILTER 448 filter.fadeIn( 300, function(){ 449 $(this).removeAttr( 'style' ).addClass( 'm-active' ); 450 }); 451 filter.on( 'click', 'button', function() { 452 453 if ( filter.parents( '.gallery-tools' ).is( ':last-child' ) ) { 454 $( 'html, body' ).animate({ 455 'scrollTop' : $this.offset().top - 95 456 }, 300 ); 457 } 458 459 var filterValue = $(this).attr( 'data-filter' ) ? $(this).attr( 'data-filter' ) : '*'; 460 itemList.isotope({ filter: filterValue }); 461 filter.find( '.m-active' ).removeClass( 'm-active' ); 462 filter.find( '*[data-filter="' + filterValue + '"]' ).addClass( 'm-active' ); 463 464 }); 465 466 $this.addClass( 'm-images-loaded' ); 467 468 }); 469 470 // AJAXED PAGINATION 471 var loadBtn = $this.find( '.c-pagination.m-ajaxed a' ); 472 loadBtn.click(function(){ 473 if ( ! loadBtn.hasClass( 'm-loading' ) ) { 474 475 var url = loadBtn.attr( 'href' ) + ' .c-gallery', 476 label = loadBtn.html(), 477 loadingLabel = loadBtn.data( 'loading-label' ) ? loadBtn.data( 'loading-label' ) : 'Loading', 478 noMoreLabel = loadBtn.data( 'no-more-label' ) ? loadBtn.data( 'no-more-label' ) : 'No more items'; 479 480 loadBtn.addClass( 'm-loading' ); 481 loadBtn.html( loadingLabel ); 482 483 // LOAD 484 $( 'body' ).append( '<div class="c-loading-container" style="display: none;"></div>' ); 485 var loadingContainer = $( '.c-loading-container' ).last(); 486 loadingContainer.load( url, function( response, status, xhr ){ 487 loadingContainer.lsvrImagesLoaded(function(){ 488 489 // ADD NEW ITEMS 490 var newItems = loadingContainer.find( '.item-list > .item' ); 491 itemList.append( newItems ).isotope( 'appended', newItems ); 492 493 // CHECK FOR PAGINATION 494 if ( loadingContainer.find( '.c-pagination.m-ajaxed' ).length > 0 || loadingContainer.find( '.c-pagination ul > li:last-child:not( .m-active )' ).length > 0 ) { 495 496 loadBtn.removeClass( 'm-loading' ).html( label ); 497 var nextLink = loadingContainer.find( '.c-pagination a' ).last().attr( 'href' ); 498 loadBtn.attr( 'href', nextLink ); 499 500 } 501 else { 502 503 loadBtn.html( noMoreLabel ); 504 505 // HIDE PAGINATION 506 $this.find( '.c-pagination' ).one( 'inview', function(){ 507 setTimeout(function(){ 508 $this.find( '.c-pagination' ).slideUp(300, function(){ 509 $(this).remove(); 510 }); 511 }, 3000); 512 });
513 514 } 515 516 // REMOVE LOADING CONTAINER 517 loadingContainer.remove(); 518 519 // INIT LIGHTBOXES 520 if ( $.fn.lsvrInitLightboxes ) { 521 itemList.lsvrInitLightboxes(); 522 } 523 524 // INIT AJAX MODALS 525 lsvrInitGalleryAjaxModals(); 526 527 }); 528 }); 529 530 } 531 return false; 532 }); 533 534 }); 535 } 536 537 /* ------------------------------------------------------------------------- 538 GOOGLE MAP 539 ------------------------------------------------------------------------- */ 540 541 if ( $.fn.lsvrLoadGoogleMaps && $( '.c-gmap' ).length > 0 ) { 542 $.fn.lsvrLoadGoogleMaps(); 543 } 544 545 /* ------------------------------------------------------------------------- 546 PARALLAX SECTION 547 ------------------------------------------------------------------------- */ 548 549 if ( $.fn.parallax ) { 550 551 // Webkit background-attachment:fixed bug fix 552 if ( 'WebkitAppearance' in document.documentElement.style ) { 553 $( '.c-parallax-section' ).each(function(){ 554 $(this).fadeOut(1).fadeIn(1); 555 }); 556 } 557 558 // DYNAMIC 559 $( '.c-parallax-section.m-dynamic' ).each(function(){ 560 if ( mediaQueryBreakpoint > 1199 ) { 561 $(this).parallax( '50%', 0.3 ); 562 } 563 }); 564 565 // VIDEO 566 if ( $.fn.okvideo && $.fn.lsvrYoutubeIdParser ) { 567 if ( mediaQueryBreakpoint > 1199 ) { 568 $( '.c-parallax-section[data-videobg]' ).each(function(){ 569 570 var $this = $(this), 571 videoId = $.fn.lsvrYoutubeIdParser( $this.data( 'videobg' ) ); 572 573 if ( videoId !== '' ) { 574 $this.addClass( 'videobg-parent' ); 575 $this.prepend( '<div class="videobg-holder"><div class="videobg-holder-inner"></div></div>' ); 576 var videoInner = $this.find( '.videobg-holder-inner' ); 577 videoInner.okvideo({ source: videoId, 578 volume: 0, 579 loop: true, 580 hd: true, 581 adproof: true, 582 annotations: false 583 }); 584 } 585 586 }); 587 } 588 } 589 590 } 591 592 /* ------------------------------------------------------------------------- 593 PROGRESS BAR 594 ------------------------------------------------------------------------- */ 595 596 if ( $.fn.lsvrProgressBar ) { 597 $( '.c-progress-bar' ).each(function(){ 598 $(this).lsvrProgressBar(); 599 }); 600 } 601 602 /* ------------------------------------------------------------------------- 603 SLIDER 604 ------------------------------------------------------------------------- */ 605 606 if ( $.fn.lsvrSlider ) { 607 $( '.c-slider' ).each(function(){ 608 $(this).lsvrSlider(); 609 }); 610 } 611 612 /* ------------------------------------------------------------------------- 613 TABS 614 ------------------------------------------------------------------------- */ 615 616 if ( $.fn.lsvrTabs ) { 617 $( '.c-tabs' ).each(function(){ 618 $(this).lsvrTabs(); 619 }); 620 } 621 622 623/* ----------------------------------------------------------------------------- 624 625 3.) HEADER 626 627----------------------------------------------------------------------------- */ 628 629var $header = $( '#header' ); 630 631 /* ------------------------------------------------------------------------- 632 HEADER MENU 633 ------------------------------------------------------------------------- */ 634 635 $header.find( '.header-menu li:last-child' ).addClass( 'm-last' ); 636 $header.find( '.header-menu li:last-child' ).prev().addClass( 'm-penultimate' ); 637 638 // SUBMENU 639 $.fn.headerSubmenu = function(){ 640 641 var $this = $(this), 642 parent = $this.parent(); 643 644 parent.addClass( 'm-has-submenu' ); 645 646 // HOVER 647 parent.hover(function(){ 648 if ( mediaQueryBreakpoint > 1199 ) { 649 parent.addClass( 'm-hover' ); 650 $this.show().addClass( 'animated fadeInDown' ); 651 } 652 }, function(){ 653 if ( mediaQueryBreakpoint > 1199 ) { 654 parent.removeClass( 'm-hover' ); 655 $this.hide().removeClass( 'animated fadeInDown' ); 656 } 657 }); 658 659 }; 660 $header.find( '.header-menu ul > li > ul' ).each(function(){ 661 $(this).headerSubmenu(); 662 }); 663 664 /* ------------------------------------------------------------------------- 665 FIXED HEADER 666 ------------------------------------------------------------------------- */ 667 668 if ( $header.hasClass( 'm-enable-fixed' ) ) { 669 670 // CREATE CLONE 671 $header.clone( true ).prependTo( 'body' ); 672 $( 'body' ).find( '#header' ).first().attr( 'id', 'header-fixed' ); 673 var headerClone = $( '#header-fixed' ); 674 headerClone.removeAttr( 'style' ); 675 headerClone.find( '.header-menu li' ).removeAttr( 'id' ); 676 677 // SET LOGO 678 headerClone.find( '.header-branding img' ).each(function(){ 679 var img = $(this); 680 if ( window.devicePixelRatio > 1 && img.attr( 'data-fixed-hires' )) { 681 img.attr( 'src', img.attr( 'data-fixed-hires' ) ); 682 } 683 else if ( img.attr( 'data-fixed' ) ) { 684 img.attr( 'src', img.attr( 'data-fixed' ) ); 685 } 686 if ( img.attr( 'data-fixed-width' ) ) { 687 img.attr( 'width', img.attr( 'data-fixed-width' ) ); 688 } 689 else { 690 img.removeAttr( 'width' ); 691 } 692 if ( img.attr( 'data-fixed-height' ) ) { 693 img.attr( 'height', img.attr( 'data-fixed-height' ) ); 694 } 695 else { 696 img.removeAttr( 'height' ); 697 } 698 }); 699 700 // SHOW 701 $( document ).on( 'headerScrolledOut', function(){ 702 headerClone.show().addClass( 'm-active' ); 703 }); 704 705 // HIDE 706 $( document ).on( 'headerScrolledIn', function(){ 707 headerClone.show().removeClass( 'm-active' ); 708 }); 709 710 // SUBMENU 711 headerClone.find( '.header-menu ul > li > ul' ).each(function(){ 712 $(this).headerSubmenu(); 713 }); 714 715 } 716 717 /* ------------------------------------------------------------------------- 718 SCROLLSPY 719 ------------------------------------------------------------------------- */ 720 721 $( '#header .header-menu > ul a[href^="#"]' ).each(function(){ 722 723 var $this = $(this), 724 link = $this.attr( 'href' ), 725 anchor; 726 727 // SCROLLSPY 728 if ( $.fn.lsvrScrollspy && $( link ).length > 0 && ! $( link ).hasClass( 'scrollspied' ) ) { 729 730 $( link ).addClass( 'scrollspied' ); 731 $( link ).lsvrScrollspy({ 732 tolerance: 200, 733 onEnter: function(){ 734 $( '.header-menu > ul > li.m-active, .sidebar-menu > ul > li.m-active' ).removeClass( 'm-active' ); 735 $( '.header-menu a[href="' + link + '"], .sidebar-menu a[href="' + link + '"]' ).parent().addClass( 'm-active' ); 736 } 737 }); 738 739 } 740 741 }); 742 743 // DEAL WITH DEFAULT ACTIVE 744 $( '.header-menu .m-active' ).addClass( 'm-active-default' ); 745 if ( $( '.scrollspied' ).length > 0 ) { 746 $( '#header .header-content' ).lsvrScrollspy({ 747 tolerance: 0, 748 onEnter: function(){ 749 $( '.header-menu > ul li.m-active' ).removeClass( 'm-active' ); 750 $( '.header-menu .m-active-default, .sidebar-menu .m-active-default' ).addClass( 'm-active' ); 751 } 752 }); 753 } 754 755 /* ------------------------------------------------------------------------- 756 HEADER SCROLLED OUT 757 ------------------------------------------------------------------------- */ 758 759 var isHeaderScrolledOut = function(){ 760 //if ( mediaQueryBreakpoint > 1199 ) { 761 762 var scrollTop = $(window).scrollTop(); 763 $header.each(function() { 764 var bottomDistance = $(this).offset().top + $(this).height(); 765 if ( ( bottomDistance ) < scrollTop ) { 766 767 $( 'body' ).addClass( 'm-header-scrolled-out' ); 768 769 // TRIGGER EVENT 770 $.event.trigger({ 771 type: 'headerScrolledOut', 772 message: 'Header scrolled off screen.', 773 time: new Date() 774 });
775 776 } 777 else if ( $( 'body' ).hasClass( 'm-header-scrolled-out' ) ) { 778 779 $( 'body' ).removeClass( 'm-header-scrolled-out' ); 780 781 // TRIGGER EVENT 782 $.event.trigger({ 783 type: 'headerScrolledIn', 784 message: 'Header scrolled to screen.', 785 time: new Date() 786 }); 787 788 } 789 }); 790 791 //} 792 }; 793 isHeaderScrolledOut(); 794 $(window).on( 'scroll', function() { 795 isHeaderScrolledOut(); 796 }); 797 798 /* ------------------------------------------------------------------------- 799 VIDEO HEADER 800 ------------------------------------------------------------------------- */ 801 802 if ( $.fn.okvideo && $header.data( 'videobg-id' ) ) { 803 804 var videoId = $header.data( 'videobg-id' ); 805 $header.prepend( '<div class="videobg-holder"><div class="videobg-holder-inner"></div></div>' ); 806 var videoInner = $header.find( '.videobg-holder-inner' ); 807 808 videoInner.okvideo({ source: videoId, 809 volume: 0, 810 loop: true, 811 hd: true, 812 adproof: true, 813 annotations: false 814 }); 815 816 } 817 818 819/* ----------------------------------------------------------------------------- 820 821 4.) CORE 822 823----------------------------------------------------------------------------- */ 824 825 /* ------------------------------------------------------------------------- 826 ARTICLE COMMENTS 827 ------------------------------------------------------------------------- */ 828 829 $( '#commentform' ).each(function(){ 830 831 var $form = $(this); 832 $form.addClass( 'default-form' ); 833 834 // VALIDATE 835 if ( $.fn.lsvrIsFormValid ) { 836 $form.find( '.required' ).addClass( 'm-required' ); 837 $form.find( '.email' ).addClass( 'm-email' ); 838 $form.submit(function(){ 839 if ( ! $form.lsvrIsFormValid() ) { 840 $form.find( '.m-validation-error' ).slideDown( 300 ); 841 return false; 842 } 843 }); 844 } 845 846 // EDIT SUBMIT BTN 847 $form.find( '#submit' ).addClass( 'c-button m-medium' ); 848 if ( $form.parents( '.user-logged-in' ).length < 1 ) { 849 $form.find( '.form-submit' ).wrap( '<div class="row"><div class="col-sm-6 col-sm-offset-6"></div></div>' ); 850 } 851 852 }); 853 854 /* ------------------------------------------------------------------------- 855 PORTFOLIO DETAIL 856 ------------------------------------------------------------------------- */ 857 858 var lsvrInitProjectDetail = function( isModal ){ 859 860 // PROJECT IMAGES AS SLIDER 861 if ( $.fn.owlCarousel ) { 862 863 var prefixSelector = ''; 864 if ( typeof isModal !== 'undefined' && isModal ) { 865 prefixSelector = '.modal-box '; 866 } 867 868 $( prefixSelector + '.portfolio-detail .project-images.m-paginated' ).each(function(){ 869 870 var $this = $(this), 871 imageCount = $this.children().length, 872 activeIndex = 0, 873 imageTitles = []; 874 875 if ( $this.find( 'img' ) ) { 876 877 // GET LIST OF IMAGE TITLES 878 $this.find( 'a' ).each(function(){ 879 if ( $(this).attr( 'title' ) && $(this).attr( 'title' ) !== '' ) { 880 imageTitles.push( $(this).attr( 'title' ) ); 881 } 882 else { 883 imageTitles.push( '' ); 884 } 885 }); 886 887 if ( $this.children().length > 1 ) { 888 889 // INIT CAROUSEL 890 $this.owlCarousel({ 891 autoPlay: false, 892 slideSpeed: 300, 893 pagination: false, 894 paginationSpeed : 400, 895 singleItem: true, 896 autoHeight: true, 897 addClassActive: true, 898 afterMove: function(){ 899 900 // CHANGE IMAGE TITLE AFTER MOVE 901 activeIndex = $this.find( '.owl-item.active' ).index(); 902 $this.find( '.image-info h2' ).fadeOut( 300, function(){ 903 if ( imageTitles[ activeIndex ] !== '' ) { 904 $this.find( '.image-info h2' ).html( imageTitles[ activeIndex ] ); 905 $this.find( '.image-info h2' ).fadeIn(300); 906 } 907 });
908 909 } 910 }); 911 912 } 913 914 // CREATE IMAGE INFO 915 if ( imageCount > 1 || imageTitles[0] !== '' ) { 916 917 $this.append( '<div class="image-info"><div class="container"><div class="images-nav"><button class="c-button m-outline nav-prev" type="button"><i class="fa fa-chevron-left"></i></button><button class="c-button m-outline nav-next" type="button"><i class="fa fa-chevron-right"></i></button></div></div></div>' ); 918 var imageInfo = $this.find( '.image-info' ), 919 navPrev = imageInfo.find( '.nav-prev' ), 920 navNext = imageInfo.find( '.nav-next' ); 921 922 // INITIAL IMAGE TITLE 923 if ( imageTitles[0] !== '' ) { 924 imageInfo.find( '.container' ).prepend( '<h2>' + imageTitles[0] + '</h2>' ); 925 } 926 927 // NAVIGATION 928 navPrev.click(function(){ 929 $this.trigger( 'owl.prev' ); 930 }); 931 navNext.click(function(){ 932 $this.trigger( 'owl.next' ); 933 }); 934 935 } 936 937 } 938 939 }); 940 } 941 942 }; 943 lsvrInitProjectDetail(); 944 945/* ----------------------------------------------------------------------------- 946 947 5.) WIDGETS 948 949----------------------------------------------------------------------------- */ 950 951 /* ------------------------------------------------------------------------- 952 DRIBBBLE WIDGET 953 ------------------------------------------------------------------------- */ 954 955 if ( $.fn.lsvrDribbbleFeed ) { 956 $( '.widget.dribbble-feed' ).each(function(){ 957 $(this).lsvrDribbbleFeed(); 958 }); 959 } 960 961 /* ------------------------------------------------------------------------- 962 FLICKR WIDGET 963 ------------------------------------------------------------------------- */ 964 965 if ( $.fn.lsvrFlickrFeed ) { 966 $( '.widget.flickr-feed' ).each(function(){ 967 $(this).lsvrFlickrFeed(); 968 }); 969 } 970 971 /* ------------------------------------------------------------------------- 972 INSTAGRAM WIDGET 973 ------------------------------------------------------------------------- */ 974 975 if ( $.fn.lsvrInstagramFeed ) { 976 $( '.widget.instagram-feed' ).each(function(){ 977 $(this).lsvrInstagramFeed(); 978 }); 979 } 980 981 /* ------------------------------------------------------------------------- 982 SUBSCRIBE WIDGET 983 ------------------------------------------------------------------------- */ 984 985 if ( $.fn.lsvrMailchimpSubscribeForm ) { 986 $( '.widget.mailchimp-subscribe' ).each(function(){ 987 $(this).lsvrMailchimpSubscribeForm(); 988 }); 989 } 990 991 /* ------------------------------------------------------------------------- 992 TWITTER WIDGET 993 ------------------------------------------------------------------------- */ 994 995 if ( $.fn.lsvrTwitterFeed ) { 996 $( '.widget.twitter-feed' ).each(function(){ 997 $(this).lsvrTwitterFeed(); 998 }); 999 } 1000 1001 1002/* ----------------------------------------------------------------------------- 1003 1004 6.) MAIN SIDEBAR 1005 1006----------------------------------------------------------------------------- */ 1007 1008 /* ------------------------------------------------------------------------- 1009 TOGGLE 1010 ------------------------------------------------------------------------- */ 1011 1012 $( '#main-sidebar' ).each(function(){ 1013 1014 var $this = $(this); 1015 1016 // TOGGLE BTN CLICK 1017 $( '.main-sidebar-toggle' ).click(function(){ 1018 if ( $this.hasClass( 'm-active' ) ){ 1019 1020 // TRIGGER CLOSE EVENT 1021 $.event.trigger({ 1022 type: 'mainSidebarClosed', 1023 message: 'Main sidebar closed.', 1024 time: new Date() 1025 }); 1026 1027 } 1028 else { 1029 1030 // TRIGGER OPEN EVENT 1031 $.event.trigger({ 1032 type: 'mainSidebarOpened', 1033 message: 'Main sidebar opened.', 1034 time: new Date() 1035 }); 1036 1037 } 1038 }); 1039 1040 // CLOSE BTN CLICK 1041 $this.find( '.sidebar-close' ).click(function(){ 1042 1043 // TRIGGER CLOSE EVENT 1044 $.event.trigger({ 1045 type: 'mainSidebarClosed', 1046 message: 'Main sidebar closed.', 1047 time: new Date() 1048 }); 1049 1050 }); 1051 1052 // OPEN ACTIONS 1053 $( document ).on( 'mainSidebarOpened', function(){ 1054 1055 $( '.main-sidebar-toggle' ).addClass( 'm-active' ); 1056 $this.toggleClass( 'm-active' ); 1057 $( 'html' ).toggleClass( 'm-main-sidebar-active' ); 1058 1059 }); 1060 1061 // CLOSE ACTIONS 1062 $( document ).on( 'mainSidebarClosed', function(){ 1063 $( '.main-sidebar-toggle' ).removeClass( 'm-active' ); 1064 $this.removeClass( 'm-active' ); 1065 $( 'html' ).removeClass( 'm-main-sidebar-active' ); 1066 }); 1067/* 1068 // iOS & CHROME BODY SCROLLING FIX 1069 if ( mediaQueryBreakpoint < 1200 ) { 1070 $( 'body' ).on( 'touchmove', function (e) { 1071 if ( $this.hasClass( 'm-active' ) ) { 1072 if ( ! $this.has( $( e.target ) ).length ) { 1073 e.preventDefault(); 1074 } 1075 } 1076 }); 1077 $( 'body' ).on( 'mousewheel DOMMouseScroll', function (e) { 1078 if ( $this.hasClass( 'm-active' ) ) { 1079 if ( ! $this.has( $( e.target ) ).length ) { 1080 e.preventDefault(); 1081 } 1082 } 1083 }); 1084 }*/ 1085 1086 }); 1087 1088 /* ------------------------------------------------------------------------- 1089 SIDEBAR MENU 1090 ------------------------------------------------------------------------- */ 1091 1092 $( '#main-sidebar .sidebar-menu ul > li > ul' ).each(function(){ 1093 1094 var $this = $(this), 1095 parent = $this.parent(); 1096 1097 parent.addClass( 'm-has-submenu' ); 1098 1099 // CREATE TOGGLES 1100 parent.append( '<button class="toggle" type="button"><i class="fa"></i></button>' ); 1101 var toggle = parent.find( '> .toggle' ); 1102 1103 // TOGGLE 1104 toggle.click( function(){ 1105 toggle.toggleClass( 'm-active' ); 1106 $this.slideToggle( 300 ); 1107 }); 1108 1109 }); 1110 1111 1112/* ----------------------------------------------------------------------------- 1113 1114 7.) OTHER 1115 1116----------------------------------------------------------------------------- */ 1117 1118 /* ------------------------------------------------------------------------- 1119 SCROLL ANIMATION 1120 ------------------------------------------------------------------------- */ 1121 1122 $( 'a[href^="#"]' ).each(function(){ 1123 1124 var $this = $(this), 1125 element = $this.attr( 'href' ); 1126 1127 if ( $( element ).length > 0 ) { 1128 $this.click(function(e){
1129 $( 'html, body' ).animate({ 1130 'scrollTop' : $( element ).offset().top - 95 1131 }, 500); 1132 return false; 1133 }); 1134 } 1135 1136 }); 1137 1138}); 1139})(jQuery); 1140 1141/* ----------------------------------------------------------------------------- 1142 1143 8.) STYLE SWITCHER 1144 1145----------------------------------------------------------------------------- */ 1146 1147(function($){ "use strict"; 1148$(document).ready(function(){ 1149 1150 if ( $( 'body' ).hasClass( 'm-has-style-switcher' ) ) { 1151 1152 var templateDirectoryUri = $( 'head' ).data( 'template-uri' ); 1153 1154 // CREATE STYLE SWITCHER 1155 var styleSwitcherHtml = '<div id="style-switcher"><button class="style-switcher-toggle"><i class="ico fa fa-tint"></i></button>'; 1156 styleSwitcherHtml += '<div class="style-switcher-content"><ul class="skin-list">'; 1157 styleSwitcherHtml += '<li><button class="skin-default m-active" data-skin="default"><span>Default</span></button></li>'; 1158 styleSwitcherHtml += '<li><button class="skin-turquoise" data-skin="turquoise"><span>Turquoise</span></button></li>'; 1159 styleSwitcherHtml += '<li><button class="skin-lime" data-skin="lime"><span>Lime</span></button></li>'; 1160 styleSwitcherHtml += '<li><button class="skin-violet" data-skin="violet"><span>Violet</span></button></li>'; 1161 styleSwitcherHtml += '</ul><ul class="switch-list">'; 1162 styleSwitcherHtml += '<li><button class="switch-boxed"><i class="ico fa fa-check-square-o"></i> Boxed Layout</button></li>'; 1163 styleSwitcherHtml += '</ul></div></div>'; 1164 $( 'body' ).append( styleSwitcherHtml ); 1165 1166 // INIT SWITCHER 1167 $( '#style-switcher' ).each(function(){ 1168 1169 var switcher = $(this), 1170 toggle = switcher.find( '.style-switcher-toggle' ), 1171 skins = switcher.find( '.skin-list button' ), 1172 switches = switcher.find( '.switch-list button' ), 1173 vibeswpStyleSwitcher = {}; 1174 1175 //localStorage.clear(); 1176 1177 // SAVE SETTINGS 1178 var styleSwitcherSave = function(){ 1179 if ( $( 'html' ).hasClass( 'localstorage' ) ) { 1180 localStorage.vibeswpStyleSwitcher = JSON.stringify( vibeswpStyleSwitcher ); 1181 } 1182 }; 1183 1184 // LOAD SETTINGS 1185 if ( $( 'html' ).hasClass( 'localstorage' ) && localStorage.vibeswpStyleSwitcher ) { 1186 1187 vibeswpStyleSwitcher = JSON.parse( localStorage.vibeswpStyleSwitcher ); 1188 1189 // LOAD SAVED SKIN 1190 if ( typeof vibeswpStyleSwitcher.skin !== 'undefined' ) { 1191 skins.filter( '.m-active' ).removeClass( 'm-active' ); 1192 skins.filter( '[data-skin="' + vibeswpStyleSwitcher.skin + '"]' ).addClass( 'm-active' ); 1193 if ( $( 'head #skin-temp' ).length < 1 ) { 1194 $( 'head' ).append( '<link id="skin-temp" rel="stylesheet" type="text/css" href="' + templateDirectoryUri + '/library/css/skin/' + vibeswpStyleSwitcher.skin + '.css">' ); 1195 } 1196 } 1197 // LOAD BOXED SWITCH 1198 if ( typeof vibeswpStyleSwitcher.boxed !== 'undefined' ) { 1199 1200 if ( vibeswpStyleSwitcher.boxed ) { 1201 switches.filter( '.switch-boxed' ).addClass( 'm-active' ); 1202 switches.filter( '.switch-boxed' ).find( '.ico' ).removeClass( 'fa-square-o' ).addClass( 'fa-check-square-o' ); 1203 $( 'body' ).addClass( 'm-boxed-layout' ); 1204 } 1205 else { 1206 switches.filter( '.switch-boxed' ).removeClass( 'm-active' ); 1207 switches.filter( '.switch-boxed' ).find( '.ico' ).removeClass( 'fa-check-square-o' ).addClass( 'fa-square-o' ); 1208 $( 'body' ).removeClass( 'm-boxed-layout' ); 1209 } 1210 1211 // REINIT ISOTOPS AND CAROUSELS 1212 $(window).trigger( 'resize' ); 1213 window.dispatchEvent( new Event( 'resize' ) ); 1214 $( '.c-slider' ).each(function(){ 1215 if ( $(this).find( '.slide-list' ).data( 'owlCarousel' ) ) { 1216 $(this).find( '.slide-list' ).data( 'owlCarousel' ).reinit(); 1217 } 1218 }); 1219 1220 } 1221 1222 } 1223 // TOGGLE SWITCHER 1224 toggle.click(function(){ 1225 switcher.toggleClass( 'm-active' ); 1226 }); 1227 1228 // SET SKIN 1229 skins.click(function(){ 1230 skins.filter( '.m-active' ).removeClass( 'm-active' ); 1231 $(this).toggleClass( 'm-active' ); 1232 vibeswpStyleSwitcher.skin = $(this).data( 'skin' ); 1233 styleSwitcherSave(); 1234 if ( $( 'head #skin-temp' ).length < 1 ) { 1235 $( 'head' ).append( '<link id="skin-temp" rel="stylesheet" type="text/css" href="' + templateDirectoryUri + '/library/css/skin/' + $(this).data( 'skin' ) + '.css">' ); 1236 } 1237 else { 1238 $( '#skin-temp' ).attr( 'href', templateDirectoryUri + '/library/css/skin/' + $(this).data( 'skin' ) + '.css' ); 1239 } 1240 }); 1241 1242 // SET SWITCHES 1243 switches.click(function(){ 1244 1245 var self = $(this), 1246 ico = self.find( '.ico' ); 1247 self.toggleClass( 'm-active' ); 1248 ico.toggleClass( 'fa-check-square-o fa-square-o' ); 1249 1250 // ANIMATED HEADER 1251 if ( self.hasClass( 'switch-boxed' ) ) { 1252 1253 $( 'body' ).toggleClass( 'm-boxed-layout' ); 1254 vibeswpStyleSwitcher.boxed = self.hasClass( 'm-active' ) ? true : false; 1255 1256 // REINIT ISOTOPS AND CAROUSELS 1257 $(window).trigger( 'resize' ); 1258 window.dispatchEvent( new Event( 'resize' ) ); 1259 $( '.c-slider' ).each(function(){ 1260 if ( $(this).find( '.slide-list' ).data( 'owlCarousel' ) ) { 1261 $(this).find( '.slide-list' ).data( 'owlCarousel' ).reinit(); 1262 } 1263 });
1264 1265 } 1266 1267 styleSwitcherSave(); 1268 1269 }); 1270 1271 }); 1272 1273 1274 } 1275 1276}); 1277})(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.