1(function($){ 2 3 "use strict"; 4 5 6 /* --------------------------------------------------------------------------- 7 * Global vars 8 * --------------------------------------------------------------------------- */ 9 10 var scrollticker; // Scroll Timer | don't need to set this in every scroll 11 12 var rtl = $( 'body' ).hasClass( 'rtl' ); 13 var simple = $( 'body' ).hasClass( 'style-simple' ); 14 15 var top_bar_top = '61px'; 16 var header_H = 0; 17 var mobile_init_W = ( window.mfn.mobile_init ) ? window.mfn.mobile_init : 1240; 18 19 var lightbox_attr = false; 20 21 22 /* --------------------------------------------------------------------------- 23 * Lightbox | Magnific Popup 24 * --------------------------------------------------------------------------- */ 25 26 if( ! window.mfn_lightbox.disable ){ 27 if( ! ( window.mfn_lightbox.disableMobile && ( window.innerWidth < 768 ) ) ){ 28 lightbox_attr = { 29 title : window.mfn_lightbox.title ? window.mfn_lightbox.title : false, 30 }; 31 } 32 } 33 34 35 /* --------------------------------------------------------------------------- 36 * Admin Bar & WooCommerce Store Notice 37 * --------------------------------------------------------------------------- */ 38 39 function adminBarH(){ 40 var height = 0; 41 42 // WP adminbar 43 if( $( 'body' ).hasClass( 'admin-bar' ) ){ 44 height += $( '#wpadminbar' ).innerHeight(); 45 } 46 47 // WC demo store 48 if( $( 'body' ).hasClass( 'woocommerce-demo-store' ) ){ 49 height += $( 'body > p.demo_store' ).innerHeight(); 50 } 51 52 return height; 53 } 54 55 56 /* --------------------------------------------------------------------------- 57 * Header | Sticky 58 * --------------------------------------------------------------------------- */ 59 60 function mfn_sticky(){ 61 if( $( 'body' ).hasClass( 'sticky-header' ) ){ 62 if( ! ( $( 'body' ).hasClass( 'header-creative' ) && window.innerWidth >= 768 ) ){ 63 64 var start_y = header_H; 65 var window_y = $( window ).scrollTop(); 66 67 if( window_y > start_y ){ 68 69 if( ! ( $( '#Top_bar' ).hasClass( 'is-sticky' ) ) ){ 70 71 $( '.header_placeholder' ).css( 'height', $( '#Top_bar' ).height() ); 72 73 $( '#Top_bar' ) 74 .addClass( 'is-sticky' ) 75 .css( 'top', -60 ) 76 .animate({ 77 'top': adminBarH() + 'px' 78 }, 300 ); 79 80 // Header width 81 mfn_header(); 82 } 83 84 } else { 85 86 if( $( '#Top_bar' ).hasClass( 'is-sticky' ) ){ 87 88 $( '.header_placeholder' ).css( 'height', 0 ); 89 $( '#Top_bar' ) 90 .removeClass( 'is-sticky' ) 91 .css( 'top', top_bar_top ); 92 93 // Retina Logo - max height 94 sticky_logo(); 95 96 // Header width 97 mfn_header(); 98 99 } 100 101 } 102 103 mfn_mobile_sticky(); 104 105 } 106 } 107 } 108 109 110 /* --------------------------------------------------------------------------- 111 * Header | Sticky | Retina Logo - max height 112 * --------------------------------------------------------------------------- */ 113 function sticky_logo(){ 114 115 // ! retina display 116 if( ! window.devicePixelRatio > 1 ){ 117 return false; 118 } 119 120 var parent = $( '#Top_bar #logo' ); 121 122 // ! retina logo set 123 if( ! parent.hasClass( 'retina' ) ){ 124 return false; 125 } 126 127 var el = $( 'img.logo-main', parent ); 128 var height = el.data( 'height' ); 129 130 if( $( 'body' ).hasClass( 'logo-overflow' ) ){ 131 // do nothing 132 } else if( height > parent.data( 'height' ) ){ 133 height = parent.data( 'height' ); 134 } 135 136 el.css( 'max-height', height + 'px' ); 137 138 } 139 140 /* --------------------------------------------------------------------------- 141 * Header | Sticky | Height 142 * --------------------------------------------------------------------------- */ 143 144 function mfn_stickyH(){ 145 146 if( $('body').hasClass( 'header-below' ) ){ 147 148 // header below slider 149 header_H = $( '.mfn-main-slider' ).innerHeight() + $( '#Top_bar' ).innerHeight(); 150 151 } else { 152 153 // default 154 header_H = $( '#Top_bar' ).innerHeight() + $( '#Action_bar' ).innerHeight(); 155 156 } 157 158 } 159 160 161 /* --------------------------------------------------------------------------- 162 * Header | Sticky | Mobile 163 * --------------------------------------------------------------------------- */ 164 165 function mfn_mobile_sticky(){ 166 if( $( 'body' ).hasClass( 'mobile-sticky' ) && ( $( window ).width() < 768 ) ){ 167 168 var windowH = $( window ).height(); 169 var offset = adminBarH() + $( '#Top_bar .logo' ).height(); 170 171 if( ( ! $( '#Top_bar' ).hasClass( 'is-sticky' ) ) && $( '#Action_bar' ).is( ':visible' ) ){ 172 offset += $( '#Action_bar' ).height(); 173 } 174 175 var menuH = windowH - offset; 176 if( menuH < 176 ){ 177 menuH = 176; 178 } 179 180 $( '#Top_bar #menu' ).css( 'max-height', menuH + 'px' ); 181 182 } 183 } 184 185 186 /* --------------------------------------------------------------------------- 187 * Header | Top bar left | Width 188 * --------------------------------------------------------------------------- */ 189 190 function mfn_header(){ 191 var rightW = $('.top_bar_right').innerWidth(); 192 if( rightW && ! $('body').hasClass('header-plain') ){ 193 rightW += 10; 194 } 195 var parentW = $('#Top_bar .one').innerWidth(); 196 var leftW = parentW - rightW; 197 $('.top_bar_left, .menu > li > ul.mfn-megamenu').css( 'width', leftW ); 198 } 199 200 201 /* --------------------------------------------------------------------------- 202 * FIX | Header | Sticky | Height 203 * --------------------------------------------------------------------------- */ 204 205 function fixStickyHeaderH(){ 206 var stickyH = 0; 207 208 // FIX | sticky top bar height 209 210 var topBar = $( '.sticky-header #Top_bar' ); 211 212 if( topBar.hasClass( 'is-sticky' ) ){ 213 stickyH = $( '.sticky-header #Top_bar' ).innerHeight(); 214 } else { 215 topBar.addClass( 'is-sticky' ); 216 stickyH = $( '.sticky-header #Top_bar' ).innerHeight(); 217 topBar.removeClass( 'is-sticky' ); 218 } 219 220 // FIX | responsive 221 222 if( $( window ).width() < mobile_init_W ){ 223 224 if( $( window ).width() < 768 ){ 225 226 // mobile 227 if( ! $( 'body' ).hasClass( 'mobile-sticky' ) ){ 228 stickyH = 0; 229 } 230 231 } else { 232 233 // tablet 234 if( ! $( 'body' ).hasClass( 'tablet-sticky' ) ){ 235 stickyH = 0; 236 } 237 238 } 239 240 } else { 241 242 // desktop 243 244 // FIX | header creative 245 if( $( 'body' ).hasClass( 'header-creative' ) ){ 246 stickyH = 0; 247 } 248 249 } 250 251 return stickyH; 252 } 253 254 255 /* --------------------------------------------------------------------------- 256 * Sidebar | Height 257 * --------------------------------------------------------------------------- */ 258 259 function mfn_sidebar(){ 260 if( $('.with_aside .four.columns').length ){ 261 262 var maxH = $('#Content .sections_group').outerHeight(); 263 264 $('.with_aside .four.columns .widget-area').each(function(){ 265 $(this).css( 'min-height', 0 ); 266 if( $(this).height() > maxH ){ 267 maxH = $(this).height(); 268 } 269 }); 270 $('.with_aside .four.columns .widget-area').css( 'min-height', maxH + 'px' ); 271 272 } 273 } 274 275 276 /* --------------------------------------------------------------------------- 277 * Section | Full Screen 278 * --------------------------------------------------------------------------- */ 279 280 function mfn_sectionH(){ 281 var windowH = $( window ).height(); 282 283 // FIX | next/prev section 284 var offset = 0; 285 if( $( '.section.full-screen:not(.hide-desktop)' ).length > 1 ){ 286 offset = 5; 287 } 288 289 $( '.section.full-screen' ).each( function(){ 290 291 var section = $( this ); 292 var wrapper = $( '.section_wrapper', section ); 293 294 section 295 .css( 'padding', 0 ) 296 .css( 'min-height', windowH + offset ); 297 298 var padding = ( windowH + offset - wrapper.height() ) / 2; 299 300 if( padding < 50 ) padding = 50; 301 302 wrapper 303 .css( 'padding-top', padding + 10 ) // 20 = column margin-bottom / 2 304 .css( 'padding-bottom', padding - 10 ); 305 }); 306 } 307 308 309 /* --------------------------------------------------------------------------- 310 * Equal Height | Wraps 311 * --------------------------------------------------------------------------- */ 312 313 function mfn_equalH_wrap(){ 314 $('.section.equal-height-wrap .section_wrapper').each(function(){ 315 var maxH = 0; 316 $('> .wrap', $(this) ).each(function(){ 317 $(this).css( 'height', 'auto' ); 318 if( $(this).innerHeight() > maxH ){ 319 maxH = $(this).innerHeight(); 320 } 321 }); 322 $('> .wrap', $(this) ).css( 'height', maxH + 'px' ); 323 }); 324 } 325 326 327 /* --------------------------------------------------------------------------- 328 * Equal Height | Items 329 * --------------------------------------------------------------------------- */ 330 331 function mfn_equalH(){ 332 $('.section.equal-height .mcb-wrap-inner').each(function(){ 333 var maxH = 0; 334 335 $('> .column', $(this) ).each(function(){ 336 $(this).css( 'height', 'auto' ); 337 if( $(this).height() > maxH ){ 338 maxH = $(this).height(); 339 } 340 }); 341 $('> .column', $(this) ).css( 'height', maxH + 'px' ); 342 }); 343 } 344 345 346 /* --------------------------------------------------------------------------- 347 * Into | Full Screen 348 * --------------------------------------------------------------------------- */ 349 350 function mfn_introH(){ 351 var windowH = $( window ).height() - $('#Header_wrapper').height() - adminBarH(); 352 353 $('#Intro.full-screen').each(function(){ 354 355 var el = $(this); 356 var inner = $( '.intro-inner', el ); 357 358 el.css( 'padding', 0 ).css( 'min-height', windowH ); 359 360 var padding = ( windowH - inner.height() ) / 2; 361 inner.css( 'padding-top', padding ).css( 'padding-bottom', padding ); 362 363 }); 364 } 365 366 367 /* --------------------------------------------------------------------------- 368 * Footer | Sliding | Height 369 * --------------------------------------------------------------------------- */ 370 371 function mfn_footer(){ 372 373 // Fixed, Sliding 374 if( $('.footer-fixed #Footer, .footer-sliding #Footer').length ){ 375 376 var footerH = $('#Footer').height() - 1; 377 $('#Content').css( 'margin-bottom', footerH + 'px' ); 378 379 } 380 381 // Stick to bottom 382 if( $('.footer-stick #Footer').length ){ 383 384 var headerFooterH = $('#Header_wrapper').height() + $('#Footer').height(); 385 var documentH = $( document ).height() - adminBarH(); 386 387 if( ( documentH <= $( window ).height() ) && ( headerFooterH <= $( window ).height() ) ){ 388 $('#Footer').addClass('is-sticky'); 389 } else { 390 $('#Footer').removeClass('is-sticky'); 391 } 392 393 } 394 395 } 396 397 398 /* --------------------------------------------------------------------------- 399 * Back To Top | Sticky / Show on scroll 400 * --------------------------------------------------------------------------- */ 401 402 function backToTopSticky(){ 403 404 if( $('#back_to_top.sticky.scroll').length ){ 405 var el = $('#back_to_top.sticky.scroll'); 406 407 // Clear Timeout if one is pending 408 if( scrollticker ){ 409 window.clearTimeout(scrollticker); 410 scrollticker = null; 411 } 412 413 el.addClass('focus'); 414 415 // Set Timeout 416 scrollticker = window.setTimeout(function(){ 417 el.removeClass('focus'); 418 }, 1500); // Timeout in msec 419 420 } 421 422 } 423 424 425 /* --------------------------------------------------------------------------- 426 * niceScroll | Padding right fix for short content 427 * --------------------------------------------------------------------------- */ 428 429 function niceScrollFix(){ 430 var el = $('body > .nicescroll-rails'); 431 if( el.length ){ 432 if( el.is(":visible") ){ 433 $('body').addClass('nice-scroll'); 434 } else { 435 $('body').removeClass('nice-scroll'); 436 } 437 } 438 } 439 440 441 /* --------------------------------------------------------------------------- 442 * # Hash smooth navigation 443 * --------------------------------------------------------------------------- */ 444 445 function hashNav(){ 446 447 // # window.location.hash 448 var hash = window.location.hash; 449 450 if( hash ){ 451 452 // FIX | Master Slider 453 if( hash.indexOf( "&" ) > -1 || hash.indexOf( "/" ) > -1 ){ 454 return false;
455 } 456 457 // Contact Form 7 in popup 458 if( hash.indexOf( "wpcf7" ) > -1 ){ 459 cf7popup( hash ); 460 } 461 462 if( $( hash ).length ){ 463 464 var tabsHeaderH = $( hash ).siblings( '.ui-tabs-nav' ).innerHeight(); 465 466 $( 'html, body' ).animate({ 467 scrollTop: $( hash ).offset().top - fixStickyHeaderH() - tabsHeaderH - adminBarH() 468 }, 500 ); 469 } 470 471 } 472 473 } 474 475 476 /* --------------------------------------------------------------------------- 477 * One Page | Scroll Active 478 * --------------------------------------------------------------------------- */ 479 480 function onePageActive(){ 481 if( $('body').hasClass('one-page') ){ 482 483 var stickyH = $('.sticky-header #Top_bar').innerHeight(); 484 var windowT = $( window ).scrollTop(); 485 var start = windowT + stickyH + adminBarH() + 1; 486 var first = false; 487 488 $('div[data-id]').each(function(){ 489 490 if( $(this).visible( true ) ){ 491 if( !first ){ 492 first = $(this); 493 } else if( ( $(this).offset().top < start ) && ( $(this).offset().top > first.offset().top ) ) { 494 first = $(this); 495 } 496 } 497 498 if( first ){ 499 var newActive = first.attr('data-id'); 500 var active = '[data-hash="'+ newActive +'"]'; 501 502 if( newActive ){ 503 var menu = $('#menu'); 504 menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor'); 505 $( active, menu ) 506 .closest('li').addClass('current-menu-item') 507 .closest('.menu > li').addClass('current-menu-item'); 508 } 509 } 510 511 }); 512 513 } 514 } 515 516 517 /* --------------------------------------------------------------------------- 518 * Contact Form 7 | Popup 519 * --------------------------------------------------------------------------- */ 520 521 function cf7popup( hash ){ 522 if( hash && $( hash ).length ){ 523 var id = $( hash ).closest('.popup-content').attr('id'); 524 525 $('a.popup-link[href="#'+ id +'"]:not(.once)') 526 .addClass('once') 527 .click(); 528 529 } 530 } 531 532 533 /* --------------------------------------------------------------------------- 534 * Zoom Box | Vertical Align 535 * --------------------------------------------------------------------------- */ 536 537 function zoomBoxVerticalAlign(){ 538 $('.zoom_box').each(function(){ 539 540 var el = $(this); 541 var elH = el.height(); 542 var desc = el.find('.desc_wrap'); 543 var descH = desc.height(); 544 545 var padding = ( elH - descH ) / 2; 546 547 desc.css( 'padding-top', padding +'px' ); 548 549 }); 550 } 551 552 553 554 /* -------------------------------------------------------------------------------------------------------------------------- 555 * 556 * $( document ).ready 557 * 558 * ----------------------------------------------------------------------------------------------------------------------- */ 559 560 561 $( document ).ready( function(){ 562 563 564 /* --------------------------------------------------------------------------- 565 * Top Bar 566 * --------------------------------------------------------------------------- */ 567 568 $( '#Top_bar' ).removeClass( 'loading' ); 569 570 top_bar_top = parseInt( $('#Top_bar').css('top'), 10 ); 571 if( top_bar_top < 0 ) top_bar_top = 61; 572 top_bar_top = top_bar_top + 'px'; 573 574 575 /* --------------------------------------------------------------------------- 576 * Menu | Overlay 577 * --------------------------------------------------------------------------- */ 578 579 $( '.overlay-menu-toggle' ).click( function(e){ 580 e.preventDefault(); 581 582 $(this).toggleClass('focus'); 583 $( '#Overlay' ).stop(true,true).fadeToggle(500); 584 585 var menuH = $('#Overlay nav').height() / 2; 586 $( '#Overlay nav' ).css( 'margin-top', '-' + menuH + 'px' ); 587 }); 588 589 590 /* --------------------------------------------------------------------------- 591 * Menu | Responsive | button 592 * --------------------------------------------------------------------------- */ 593 594 $( '.responsive-menu-toggle' ).on( 'click', function(e){ 595 // e.preventDefault(); 596 597 // var el = $(this); 598 // var menu = $('#Top_bar #menu'); 599 // var menuWrap = menu.closest('.top_bar_left'); 600 601 // el.toggleClass('active'); 602 603 // // sticky menu button 604 // if( el.hasClass('is-sticky') && el.hasClass('active') && ( window.innerWidth < 768 ) ){ 605 606 // var top = 0; 607 // if( menuWrap.length ){ 608 // top = menuWrap.offset().top - adminBarH(); 609 // } 610 // $('body,html').animate({ 611 // scrollTop: top 612 // }, 200); 613 614 // } 615 $( '#menu' ).toggleClass('active'); 616 }); 617 618 619 /* --------------------------------------------------------------------------- 620 * Menu | Responsive | Side Slide 621 * --------------------------------------------------------------------------- */ 622 623 function sideSlide(){ 624 625 var slide = $( '#Side_slide' ); 626 var overlay = $( '#body_overlay' ); 627 var ss_mobile_init_W = mobile_init_W; 628 var pos = 'right'; 629 630 var shift_slide = -slide.data( 'width' ); 631 var shift_body = shift_slide / 2; 632 633 634 // constructor ---------- 635 636 var constructor = function(){ 637 if( ! slide.hasClass( 'enabled' ) ){ 638 $( 'nav#menu' ).detach().appendTo( '#Side_slide .menu_wrapper' ); 639 slide.addClass( 'enabled' ); 640 } 641 }; 642 643 644 // destructor ---------- 645 646 var destructor = function(){ 647 if( slide.hasClass( 'enabled' ) ){ 648 close(); 649 $( 'nav#menu' ).detach().prependTo( '#Top_bar .menu_wrapper' ); 650 slide.removeClass( 'enabled' ); 651 } 652 }; 653 654 655 // reload ---------- 656 657 var reload = function(){ 658 659 if( ( window.innerWidth < ss_mobile_init_W ) ){ 660 constructor(); 661 } else { 662 destructor(); 663 } 664 }; 665 666 667 // init ---------- 668 669 var init = function(){ 670 if( slide.hasClass( 'left' ) ){ 671 pos = 'left'; 672 } 673 674 // responsive off 675 if( $( 'body' ).hasClass( 'responsive-off' ) ){ 676 ss_mobile_init_W = 0; 677 } 678 679 // header simple 680 if( $( 'body' ).hasClass( 'header-simple' ) ){ 681 ss_mobile_init_W = 9999; 682 } 683 684 reload(); 685 }; 686 687 688 // reset to default ---------- 689 690 var reset = function( time ){ 691 692 $( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini'); 693 $( '.lang-wrapper', slide ).fadeOut(0); 694 695 $( '.icon.search.active', slide ).removeClass('active'); 696 $( '.search-wrapper', slide ).fadeOut(0); 697 698 $( '.menu_wrapper, .social', slide ).fadeIn( time ); 699 700 }; 701 702 703 // menu button ---------- 704 705 var button = function(){ 706 707 // show 708 if( pos == 'left' ){ 709 slide.animate( { 'left': 0 }, 300 ); 710 $('body').animate( { 'right': shift_body }, 300 ); 711 } else { 712 slide.animate( { 'right': 0 }, 300 ); 713 $('body').animate( { 'left': shift_body }, 300 ); 714 } 715 716 overlay.fadeIn(300); 717 718 // reset 719 reset(0); 720 721 }; 722 723 724 // close ---------- 725 726 var close = function(){ 727 728 if( pos == 'left' ){ 729 slide.animate( { 'left': shift_slide }, 300 ); 730 $('body').animate( { 'right': 0 }, 300 ); 731 } else { 732 slide.animate( { 'right': shift_slide }, 300 ); 733 $('body').animate( { 'left': 0 }, 300 ); 734 } 735 736 overlay.fadeOut(300); 737 738 // if page contains revolution slider, trigger resize 739 if( $('.rev_slider').length ){ 740 setTimeout( function(){ 741 $( window ).trigger( 'resize' ); 742 console.log(1); 743 }, 300 ); 744 } 745 }; 746 747 748 // search ---------- 749 750 $( '.icon.search', slide ).on( 'click', function(e){ 751 752 e.preventDefault(); 753 754 var el = $(this); 755 756 if( el.hasClass('active') ){ 757 758 $( '.search-wrapper', slide ).fadeOut(0); 759 $( '.menu_wrapper, .social', slide ).fadeIn(300); 760 761 } else { 762 763 $( '.search-wrapper', slide ).fadeIn(300); 764 $( '.menu_wrapper, .social', slide ).fadeOut(0); 765 766 $( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini'); 767 $( '.lang-wrapper', slide ).fadeOut(0); 768 769 } 770 771 el.toggleClass('active'); 772 }); 773 774 775 // search form submit ---------- 776 777 $( 'a.submit', slide ).on( 'click', function(e){ 778 e.preventDefault(); 779 $('#side-form').submit(); 780 }); 781 782 783 // lang menu ---------- 784 785 $( '.lang-active', slide ).on( 'click', function(e){ 786 e.preventDefault(); 787 788 var el = $(this); 789 790 if( el.hasClass('active') ){ 791 792 $( '.lang-wrapper', slide ).fadeOut(0); 793 $( '.menu_wrapper, .social', slide ).fadeIn(300); 794 el.children('i').attr('class','icon-down-open-mini'); 795 796 } else { 797 798 $( '.lang-wrapper', slide ).fadeIn(300); 799 $( '.menu_wrapper, .social', slide ).fadeOut(0); 800 el.children('i').attr('class','icon-up-open-mini'); 801 802 $( '.icon.search.active', slide ).removeClass('active'); 803 $( '.search-wrapper', slide ).fadeOut(0); 804 805 } 806 807 el.toggleClass('active'); 808 }); 809 810 811 // init, click, debouncedresize ---------- 812 813 // init 814 815 init(); 816 817 // click | menu button 818 819 $( '.responsive-menu-toggle' ).off( 'click' ); 820 821 $( '.responsive-menu-toggle' ).on( 'click', function(e){ 822 e.preventDefault(); 823 button(); 824 }); 825 826 // click | close 827 828 overlay.on( 'click', function(e){ 829 close(); 830 }); 831 832 $( '.close', slide ).on( 'click', function(e){ 833 e.preventDefault(); 834 close(); 835 }); 836 837 // click | below search or languages menu 838 839 $( slide ).on( 'click', function(e){ 840 if( $( e.target ).is( slide ) ){ 841 reset(300); 842 } 843 }); 844 845 // debouncedresize 846 847 $( window ).on( 'debouncedresize', reload ); 848 849 850 } 851 852 if( $( 'body' ).hasClass( 'mobile-side-slide' ) ){ 853 sideSlide(); 854 } 855 856 857 /* --------------------------------------------------------------------------- 858 * Gallery | WordPress Gallery 859 * --------------------------------------------------------------------------- */ 860 861 // Content 862 $( '.sections_group .gallery' ).each( function(){ 863 864 var el = $( this ); 865 var id = el.attr( 'id' ); 866 867 $( '> br', el ).remove(); 868 869 $( '.gallery-icon > a', el ) 870 .wrap( '<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>' ) 871 .prepend( '<div class="mask"></div>' ) 872 .children( 'img' ) 873 .css( 'height', 'auto' ) 874 .css( 'width', '100%' ); 875 876 // Link | Media File 877 if( el.hasClass( 'file' ) ){ 878 $( '.gallery-icon a', el ).attr( 'rel', 'prettyphoto['+ id +']' ); 879 } 880 881 // Masonry 882 if( el.hasClass( 'masonry' ) ){ 883 884 el.isotope({ 885 itemSelector : '.gallery-item', 886 layoutMode : 'masonry', 887 isOriginLeft : rtl ? false : true 888 }); 889 890 } 891 892 }); 893 894 // Widget 895 $( '.widget_media_gallery .gallery' ).each( function(){ 896 897 var el = $( this ); 898 var id = el.attr( 'id' ); 899 900 // Link | Media File 901 $( '.gallery-icon a', el ).attr( 'rel', 'prettyphoto[widget-'+ id +']' ); 902 }); 903 904 905 /* --------------------------------------------------------------------------- 906 * Lightbox | PrettyPhoto 907 * --------------------------------------------------------------------------- */ 908 909 $( 'a[rel^="prettyphoto[portfolio]"]' ).each(function(){ 910 911 var el = $(this); 912 var parent = el.closest( '.column' ); 913 var index = $( '.column' ).index( parent ); 914 915 el.attr( 'rel', 'prettyphoto[portfolio-'+ index +']' ); 916 917 }); 918 919 920 /* --------------------------------------------------------------------------- 921 * Lightbox | Magnific Popup 922 * with prettyPhoto backward compatibility 923 * --------------------------------------------------------------------------- */ 924 925 function lightbox(){ 926 927 var galleries = []; 928 929 930 // init ----------- 931 932 var init = function(){ 933 934 if( lightbox_attr ){ 935 compatibility(); 936 set_type(); 937 constructor(); 938 } 939 940 }; 941 942 943 // backward compatibility for prettyPhoto ---------- 944 945 var compatibility = function(){ 946 947 $( 'a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]' ).each(function(){ 948 949 var el = $( this ); 950 var rel = el.attr( 'rel' ); 951 952 if( rel ){ 953 rel = rel.replace( 'prettyphoto', 'lightbox' ); 954 } else { 955 rel = 'lightbox'; 956 } 957 958 // Visual Composer prettyPhoto 959 var data_rel = el.attr( 'data-rel' ); 960 if( data_rel ){ 961 rel = data_rel.replace( 'prettyPhoto', 'lightbox' ); 962 el.removeAttr( 'data-rel' ); 963 } 964 965 el.removeClass( 'prettyphoto' ).attr( 'rel', rel ); 966 967 }); 968 969 }; 970 971 972 // check if item is a part of gallery ---------- 973 974 var is_gallery = function( rel ){ 975 976 if( ! rel ){ 977 return false;
978 } 979 980 var reg_exp = /\[(?:.*)\]/; 981 var gallery = reg_exp.exec( rel ); 982 983 if( gallery ){ 984 gallery = gallery[0]; 985 gallery = gallery.replace( '[','' ).replace( ']','' ); 986 return gallery; 987 } 988 989 return false; 990 }; 991 992 993 // set array of names of galleries ---------- 994 995 var set_gallery = function( gallery ){ 996 997 if( galleries.indexOf( gallery ) == -1 ){ 998 galleries.push( gallery ); 999 return true; 1000 } 1001 1002 return false; 1003 }; 1004 1005 1006 // get file type by link ---------- 1007 1008 var get_type = function( src ){ 1009 1010 if( src.match(/youtube\.com\/watch/i) || src.match(/youtu\.be/i) ){ 1011 return 'iframe'; 1012 1013 } else if( src.match(/vimeo\.com/i) ){ 1014 return 'iframe'; 1015 1016 } else if( src.match(/\biframe=true\b/i) ){ 1017 return 'ajax'; 1018 1019 } else if( src.match(/\bajax=true\b/i) ){ 1020 return 'ajax'; 1021 1022 } else if( src.substr(0,1) == '#' ){ 1023 return 'inline'; 1024 1025 } else { 1026 return 'image'; 1027 1028 } 1029 }; 1030 1031 1032 // set file type ---------- 1033 1034 var set_type = function(){ 1035 1036 $( 'a[rel^="lightbox"]' ).each(function(){ 1037 1038 var el = $( this ); 1039 var href = el.attr( 'href' ); 1040 var rel = el.attr( 'rel' ); 1041 1042 if( href ){ 1043 1044 // gallery 1045 var gallery = is_gallery( rel ); 1046 if( gallery ){ 1047 el.attr( 'data-type', 'gallery' ); 1048 set_gallery( gallery ); 1049 return true; 1050 } 1051 1052 el.attr( 'data-type', get_type( href ) ); 1053 1054 // iframe paremeters 1055 if( get_type( href ) == 'iframe' ){ 1056 el.attr( 'href', href.replace( '&rel=0', '' ) ); 1057 } 1058 } 1059 1060 }); 1061 1062 }; 1063 1064 1065 // constructor ---------- 1066 1067 var constructor = function(){ 1068 1069 var attr = { 1070 autoFocusLast : false, 1071 removalDelay : 160, 1072 image : { 1073 titleSrc : function( item ){ 1074 var img = item.el.closest( '.image_wrapper' ).find( 'img' ).first(); 1075 if( lightbox_attr.title && img.length ){ 1076 return img.attr( 'alt' ); 1077 } else { 1078 return false; 1079 } 1080 } 1081 } 1082 }; 1083 1084 // image 1085 1086 $( 'a[rel^="lightbox"][data-type="image"]' ).magnificPopup({ 1087 autoFocusLast : attr.autoFocusLast, 1088 removalDelay : attr.removalDelay, 1089 type : 'image', 1090 image : attr.image 1091 }); 1092 1093 // iframe | video 1094 1095 $( 'a[rel^="lightbox"][data-type="iframe"]' ).magnificPopup({ 1096 autoFocusLast : attr.autoFocusLast, 1097 removalDelay : attr.removalDelay, 1098 type : 'iframe', 1099 iframe: { 1100 patterns: { 1101 youtube: { 1102 index: 'youtube.com/', 1103 id: 'v=', 1104 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1105 } 1106 } 1107 } 1108 }); 1109 1110 // inline 1111 1112 $( 'a[rel^="lightbox"][data-type="inline"]' ).magnificPopup({ 1113 autoFocusLast : attr.autoFocusLast, 1114 type : 'inline', 1115 midClick : true, 1116 callbacks : { 1117 open: function(){ 1118 $( '.mfp-content' ).children().addClass( 'mfp-inline' ); 1119 }, 1120 beforeClose: function(){ 1121 $( '.mfp-content' ).children().removeClass( 'mfp-inline' ); 1122 } 1123 } 1124 }); 1125 1126 // gallery 1127 1128 for( var i = 0, len = galleries.length; i < len; i++ ){ 1129 1130 var gallery = '[' + galleries[i] + ']'; 1131 gallery = 'a[rel^="lightbox' + gallery +'"]:visible'; 1132 1133 $( gallery ).magnificPopup({ 1134 autoFocusLast : attr.autoFocusLast, 1135 removalDelay : attr.removalDelay, 1136 type : 'image', 1137 image : attr.image, 1138 gallery : { 1139 enabled : true, 1140 tCounter : '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter 1141 } 1142 }); 1143 } 1144 1145 }; 1146 1147 // reload ---------- 1148 1149 var reload = function(){ 1150 1151 $( 'a[rel^="lightbox"]' ).unbind( 'click' ); 1152 constructor(); 1153 1154 } 1155 1156 // Visual Composer prettyPhoto | unbind ---------- 1157 1158 var unbindPretty = function(){ 1159 1160 if( lightbox_attr ){ 1161 $( 'a[data-rel^="prettyPhoto"], a[rel^="lightbox"]' ).each( function(){ 1162 $( this ).unbind( 'click.prettyphoto' ); 1163 }); 1164 } 1165 1166 } 1167 1168 // init ---------- 1169 1170 init(); 1171 1172 // onload ---------- 1173 1174 $( window ).on( 'load', unbindPretty ); 1175 $( document ).on( 'isotope:arrange', reload ); 1176 1177 } 1178 1179 lightbox(); 1180 1181 1182 /* --------------------------------------------------------------------------- 1183 * Menu | mfnMenu 1184 * --------------------------------------------------------------------------- */ 1185 1186 function mainMenu(){ 1187 1188 var mm_mobile_init_W = mobile_init_W; 1189 1190 if( $( 'body' ).hasClass( 'header-simple' ) || $( '#Header_creative.dropdown' ).length ){ 1191 mm_mobile_init_W = 9999; 1192 } 1193 1194 $( '#menu > ul.menu' ).mfnMenu({ 1195 addLast : true, 1196 arrows : true, 1197 mobileInit : mm_mobile_init_W, 1198 responsive : window.mfn.responsive 1199 }); 1200 1201 $( '#secondary-menu > ul.secondary-menu' ).mfnMenu({ 1202 mobileInit : mm_mobile_init_W, 1203 responsive : window.mfn.responsive 1204 }); 1205 1206 } 1207 1208 mainMenu(); 1209 1210 1211 /* --------------------------------------------------------------------------- 1212 * Menu | NOT One Page | .scroll item 1213 * Works with .scroll class 1214 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu() 1215 * --------------------------------------------------------------------------- */ 1216 1217 function onePageScroll(){ 1218 if( ! $('body').hasClass('one-page') ){ 1219 var menu = $('#menu'); 1220 1221 if( menu.find('li.scroll').length > 1 ){ 1222 menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1223 1224 // menu item click 1225 menu.find('a').click(function(){ 1226 $(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1227 $(this).closest('li').addClass('current-menu-item'); 1228 }); 1229 } 1230 } 1231 } 1232 onePageScroll(); 1233 1234 1235 /* --------------------------------------------------------------------------- 1236 * Menu | One Page | Active on Scroll & Click 1237 * --------------------------------------------------------------------------- */ 1238 1239 function onePageMenu(){ 1240 if( $('body').hasClass('one-page') ){ 1241 1242 var menu = $('#menu'); 1243 1244 1245 // add attr [data-hash] & [data-id] ---------- 1246 1247 $('a[href]', menu).each(function(){ 1248 1249 var url = $(this).attr( 'href' ); 1250 if( url && url.split('#')[1] ){ 1251 1252 // data-hash 1253 var hash = '#' + url.split('#')[1]; 1254 if( hash && $(hash).length ){ // check if element with specified ID exists 1255 $(this).attr( 'data-hash', hash ); 1256 $(hash).attr( 'data-id', hash ); 1257 } 1258 1259 // Visual Composer 1260 var vcHash = '#' + url.split('#')[1]; 1261 var vcClass = '.vc_row.' + url.split('#')[1]; 1262 if( vcClass && $(vcClass).length ){ // check if element with specified Class exists 1263 $(this).attr( 'data-hash', vcHash ); 1264 $(vcClass).attr( 'data-id', vcHash ); 1265 } 1266 1267 } 1268 1269 }); 1270 1271 1272 // active ---------- 1273 1274 var hash; 1275 var activeSelector = '.menu > li.current-menu-item, .menu > li.current-menu-parent, .menu > li.current-menu-ancestor, .menu > li.current-page-ancestor, .menu > li.current_page_item, .menu > li.current_page_parent, .menu > li.current_page_ancestor'; 1276 var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'; 1277 1278 if( $( activeSelector, menu ).length ){ 1279 1280 // remove duplicated 1281 $( activeSelector, menu ) 1282 .not(':first').removeClass( activeClasses ); 1283 1284 // remove if 1st link to section & section is not visible 1285 hash = $( activeSelector, menu ).find('a[data-hash]').attr( 'data-hash' ); 1286 1287 if( hash ){ 1288 hash = '[data-id="'+ hash +'"]'; 1289 1290 if( $(hash).length && $( hash ).visible( true ) ){ 1291 // do nothing 1292 } else { 1293 $( activeSelector, menu ).removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' ) 1294 .closest('.menu > li').removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' ); 1295 } 1296 } else { 1297 // do nothing 1298 } 1299 1300 } else { 1301 1302 // add to first if none is active 1303 var first = $( '.menu:first-child > li:first-child', menu ); 1304 var firstA = first.children('a'); 1305 1306 if( firstA.attr( 'data-hash' ) ){ 1307 hash = firstA.attr( 'data-hash' ); 1308 hash = '[data-id="'+ hash +'"]'; 1309 1310 if( $(hash).length && ( $(hash).offset().top == adminBarH() ) ){ 1311 first.addClass( 'current-menu-item' ); 1312 } 1313 } 1314 1315 } 1316 1317 1318 // click ---------- 1319 1320 $('#menu a[data-hash]').click(function(e){ 1321 e.preventDefault(); // only with: body.one-page 1322 1323 // active 1324 1325 menu.find('li').removeClass('current-menu-item'); 1326 $(this) 1327 .closest('li').addClass('current-menu-item') 1328 .closest('.menu > li').addClass('current-menu-item'); 1329 1330 var hash = $(this).attr('data-hash'); 1331 hash = '[data-id="'+ hash +'"]'; 1332 1333 // mobile - sticky header - close menu 1334 1335 if( window.innerWidth < 768 ){ 1336 $('.responsive-menu-toggle').removeClass('active'); 1337 $('#Top_bar #menu').hide(); 1338 } 1339 1340 // offset 1341 1342 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight(); 1343 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight(); 1344 1345 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1346 1347 // sticky height 1348 1349 var stickyH = fixStickyHeaderH(); 1350 1351 // FIX | Header below | 1st section 1352 if( $( 'body' ).hasClass( 'header-below' ) && $( '#Content' ).length ){ 1353 if( $( hash ).offset().top < ( $( '#Content' ).offset().top + 60 ) ){ 1354 stickyH = -1; 1355 } 1356 } 1357 1358 // animate scroll 1359 1360 $( 'html, body' ).animate({ 1361 scrollTop: $( hash ).offset().top - offset - stickyH 1362 }, 500); 1363 1364 }); 1365 1366 } 1367 } 1368 onePageMenu(); 1369 1370 1371 /* --------------------------------------------------------------------------- 1372 * Header | Creative 1373 * --------------------------------------------------------------------------- */ 1374 1375 var cHeader = 'body:not( .header-open ) #Header_creative'; 1376 var cHeaderEl = $( cHeader ); 1377 var cHeaderCurrnet; 1378 1379 function creativeHeader(){ 1380 1381 $( '.creative-menu-toggle' ).click( function(e){ 1382 e.preventDefault(); 1383 1384 cHeaderEl.addClass( 'active' ); 1385 $( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeOut( 500 ); 1386 $( '#Action_bar', cHeaderEl ).fadeIn( 500 ); 1387 1388 }); 1389 1390 } 1391 creativeHeader(); 1392 1393 $( document ).on( 'mouseenter', cHeader, function(){ 1394 cHeaderCurrnet = 1; 1395 }); 1396 1397 $( document ).on( 'mouseleave', cHeader, function(){ 1398 cHeaderCurrnet = null; 1399 setTimeout(function(){ 1400 if ( ! cHeaderCurrnet ){ 1401 1402 cHeaderEl.removeClass( 'active' ); 1403 $( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeIn( 500 ); 1404 $( '#Action_bar', cHeaderEl ).fadeOut( 500 ); 1405 1406 } 1407 }, 1000); 1408 }); 1409 1410 // Fix: Header Creative & Mobile Sticky | On Resize > 768 px 1411 function creativeHeaderFix(){ 1412 if( $( 'body' ).hasClass( 'header-creative' ) && window.innerWidth >= 768 ){ 1413 if( $( '#Top_bar' ).hasClass( 'is-sticky' ) ){ 1414 $( '#Top_bar' ).removeClass( 'is-sticky' ); 1415 } 1416 } 1417 } 1418 1419 1420 /* --------------------------------------------------------------------------- 1421 * Header | Search 1422 * --------------------------------------------------------------------------- */ 1423 1424 $("#search_button:not(.has-input), #Top_bar .icon_close").click(function(e){ 1425 e.preventDefault(); 1426 $('#Top_bar .search_wrapper').fadeToggle() 1427 .find('.field').focus(); 1428 }); 1429 1430 1431 /* --------------------------------------------------------------------------- 1432 * WPML | Language switcher in the WP Menu 1433 * --------------------------------------------------------------------------- */ 1434 1435 function mfn_wpml(){ 1436 $('#menu .menu-item-language:not(.menu-item-language-current)').each(function(){ 1437 var el = $(this).children('a'); 1438 1439 if( ! el.children('span:not(.icl_lang_sel_bracket)').length ){ 1440 el.wrapInner('<span></span>'); 1441 } 1442 1443 }); 1444 1445 $('#menu span.icl_lang_sel_bracket').each(function(){ 1446 var el = $(this); 1447 el.replaceWith( el.html() ); 1448 }); 1449 1450 } 1451 mfn_wpml(); 1452 1453 1454 /* --------------------------------------------------------------------------- 1455 * Breadcrumbs | Remove last item link 1456 * --------------------------------------------------------------------------- */ 1457 1458 function breadcrumbsRemoveLastLink(){ 1459 var el = $('.breadcrumbs.no-link').find('li').last(); 1460 var text = el.text(); 1461 el.html( text ); 1462 } 1463 breadcrumbsRemoveLastLink(); 1464 1465 1466 /* --------------------------------------------------------------------------- 1467 * Downcount 1468 * --------------------------------------------------------------------------- */ 1469 1470 $( '.downcount' ).each( function(){ 1471 var el = $(this); 1472 el.downCount({ 1473 date : el.attr('data-date'), 1474 offset : el.attr('data-offset') 1475 }); 1476 }); 1477 1478 1479 /* --------------------------------------------------------------------------- 1480 * Hover | on Touch | .tooltip, .hover_box 1481 * --------------------------------------------------------------------------- */ 1482 1483 $( '.tooltip, .hover_box' ) 1484 .bind( 'touchstart', function(){ 1485 $( this ).toggleClass( 'hover' ); 1486 }) 1487 .bind( 'touchend', function(){ 1488 $( this ).removeClass( 'hover' ); 1489 }); 1490 1491 1492 /* --------------------------------------------------------------------------- 1493 * Popup | Contact Form | Button 1494 * --------------------------------------------------------------------------- */ 1495 1496 $("#popup_contact > a.button").click(function(e){ 1497 e.preventDefault(); 1498 $(this).parent().toggleClass('focus'); 1499 }); 1500 1501 1502 /* --------------------------------------------------------------------------- 1503 * Scroll | niceScroll 1504 * --------------------------------------------------------------------------- */ 1505 1506 if( $('body').hasClass('nice-scroll-on') && window.innerWidth >= 768 && ! navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) 1507 { 1508 $('html').niceScroll({ 1509 autohidemode : false, 1510 cursorborder : 0,
1511 cursorborderradius : 5, 1512 cursorcolor : '#222222', 1513 cursorwidth : 10, 1514 horizrailenabled : false, 1515 mousescrollstep : ( window.mfn.nicescroll ) ? window.mfn.nicescroll : 40, 1516 scrollspeed : 60 1517 }); 1518 1519 $('body').removeClass('nice-scroll-on').addClass('nice-scroll'); 1520 niceScrollFix(); 1521 } 1522 1523 1524 if( ('#Header_creative.scroll').length && window.innerWidth >= 1240 ){ 1525 $('#Header_creative.scroll').niceScroll({ 1526 autohidemode : false, 1527 cursorborder : 0, 1528 cursorborderradius : 5, 1529 cursorcolor : '#222222', 1530 cursorwidth : 0, 1531 horizrailenabled : false, 1532 mousescrollstep : 40, 1533 scrollspeed : 60 1534 }); 1535 } 1536 1537 1538 /* --------------------------------------------------------------------------- 1539 * Black & White 1540 * --------------------------------------------------------------------------- */ 1541 1542 function mfn_greyscale(){ 1543 $('.greyscale .image_wrapper > a, .greyscale .image_wrapper_tiles, .greyscale.portfolio-photo a, .greyscale .client_wrapper .gs-wrapper').has('img').BlackAndWhite({ 1544 hoverEffect : false, 1545 intensity : 1 // opacity: 0, 0.1, ... 1 1546 }); 1547 } 1548 mfn_greyscale(); 1549 1550 1551 /* --------------------------------------------------------------------------- 1552 * Sliding Top 1553 * --------------------------------------------------------------------------- */ 1554 1555 $( '.sliding-top-control' ).click(function(e){ 1556 e.preventDefault(); 1557 $('#Sliding-top .widgets_wrapper').slideToggle(); 1558 $('#Sliding-top').toggleClass('active'); 1559 }); 1560 1561 1562 /* --------------------------------------------------------------------------- 1563 * Alert 1564 * --------------------------------------------------------------------------- */ 1565 1566 $(this).on('click', '.alert .close', function(e) { 1567 e.preventDefault(); 1568 $(this).closest('.alert').hide(300); 1569 }); 1570 1571 1572 /* --------------------------------------------------------------------------- 1573 * Button | mark buttons with icon & label 1574 * --------------------------------------------------------------------------- */ 1575 1576 $( 'a.button_js' ).each(function(){ 1577 var btn = $(this); 1578 if( btn.find('.button_icon').length && btn.find('.button_label').length ){ 1579 btn.addClass('kill_the_icon'); 1580 } 1581 }); 1582 1583 1584 /* --------------------------------------------------------------------------- 1585 * Navigation Arrows | Sticky 1586 * --------------------------------------------------------------------------- */ 1587 1588 $('.fixed-nav').appendTo( 'body' ); 1589 1590 1591 /* --------------------------------------------------------------------------- 1592 * Feature List 1593 * --------------------------------------------------------------------------- */ 1594 1595 $('.feature_list').each(function(){ 1596 var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4; 1597 $(this).find('li:nth-child('+ col +'n):not(:last-child)').after('<hr />'); 1598 }); 1599 1600 1601 /* --------------------------------------------------------------------------- 1602 * IE Fixes 1603 * --------------------------------------------------------------------------- */ 1604 1605 function checkIE(){ 1606 // IE 9 1607 var ua = window.navigator.userAgent; 1608 var msie = ua.indexOf("MSIE "); 1609 if( msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9 ){ 1610 $("body").addClass("ie"); 1611 } 1612 } 1613 checkIE(); 1614 1615 1616 /* --------------------------------------------------------------------------- 1617 * Parallax 1618 * --------------------------------------------------------------------------- */ 1619 1620 var ua = navigator.userAgent, 1621 isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua); 1622 1623 if( ! isMobileWebkit && window.innerWidth >= 768 ){ 1624 1625 if( window.mfn.parallax == 'stellar' ){ 1626 1627 // Stellar 1628 $.stellar({ 1629 horizontalScrolling : false, 1630 responsive : true 1631 }); 1632 1633 } else { 1634 1635 // Enllax 1636 $( window ).enllax(); 1637 1638 } 1639 1640 } else { 1641 1642 $('div[data-enllax-ratio], div[data-stellar-ratio]').css( 'background-attachment' , 'scroll' ); 1643 1644 } 1645 1646 1647 /* --------------------------------------------------------------------------- 1648 * Load More | Ajax 1649 * --------------------------------------------------------------------------- */ 1650 1651 $( '.pager_load_more' ).click(function(e){ 1652 e.preventDefault(); 1653 1654 var el = $(this); 1655 var pager = el.closest( '.pager_lm' ); 1656 var href = el.attr( 'href' ); 1657 1658 // index | for many items on the page 1659 var index = $( '.lm_wrapper' ).index(el.closest( '.isotope_wrapper' ).find( '.lm_wrapper' )); 1660 1661 el.fadeOut(50); 1662 pager.addClass( 'loading' ); 1663 1664 $.get( href, function( data ){ 1665 1666 // content 1667 var content = $( '.lm_wrapper:eq('+ index +')', data ).wrapInner('').html(); 1668 1669 if( $( '.lm_wrapper:eq('+ index +')' ).hasClass( 'isotope' ) ){ 1670 // isotope 1671 $( '.lm_wrapper:eq('+ index +')' ).append( $( content ) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); 1672 } else { 1673 // default 1674 $( content ).hide().appendTo( '.lm_wrapper:eq('+ index +')' ).fadeIn( 1000 ); 1675 } 1676 1677 // next page link 1678 href = $( '.lm_wrapper:eq('+ index +')', data ).next().find( '.pager_load_more' ).attr( 'href' ); 1679 pager.removeClass( 'loading' ); 1680 if( href ){ 1681 el.fadeIn(); 1682 el.attr( 'href', href ); 1683 } 1684 1685 // refresh some staff ------------------------------- 1686 1687 mfn_greyscale(); 1688 1689 mfn_jPlayer(); 1690 1691 lightbox(); 1692 1693 // isotope fix: second resize 1694 1695 $( '.lm_wrapper.isotope' ).imagesLoaded().progress( function() { 1696 $( '.lm_wrapper.isotope' ).isotope( 'layout' ); 1697 }); 1698 1699 }); 1700 1701 }); 1702 1703 1704 /* --------------------------------------------------------------------------- 1705 * Filters | Blog & Portfolio 1706 * --------------------------------------------------------------------------- */ 1707 1708 $('.filters_buttons .open').click(function(e){ 1709 e.preventDefault(); 1710 var type = $(this).closest('li').attr('class'); 1711 $('.filters_wrapper').show(200); 1712 $('.filters_wrapper ul.'+ type).show(200); 1713 $('.filters_wrapper ul:not(.'+ type +')').hide(); 1714 }); 1715 1716 $('.filters_wrapper .close a').click(function(e){ 1717 e.preventDefault(); 1718 $('.filters_wrapper').hide(200); 1719 }); 1720 1721 1722 /* --------------------------------------------------------------------------- 1723 * Portfolio List | Next v / Prev ^ buttons 1724 * --------------------------------------------------------------------------- */ 1725 1726 $('.portfolio_next_js').click(function(e){ 1727 e.preventDefault(); 1728 1729 var item = $(this).closest('.portfolio-item').next(); 1730 1731 if( item.length ){ 1732 $('html, body').animate({ 1733 scrollTop: item.offset().top - fixStickyHeaderH() 1734 }, 500); 1735 } 1736 }); 1737 1738 $('.portfolio_prev_js').click(function(e){ 1739 e.preventDefault(); 1740 1741 var item = $(this).closest('.portfolio-item').prev(); 1742 1743 if( item.length ){ 1744 $('html, body').animate({ 1745 scrollTop: item.offset().top - fixStickyHeaderH() 1746 }, 500); 1747 } 1748 }); 1749 1750 1751 /* --------------------------------------------------------------------------- 1752 * Link | Smooth Scroll | .scroll 1753 * --------------------------------------------------------------------------- */ 1754 1755 $( '.scroll > a, a.scroll' ).click( function(e){ 1756 1757 // prevent default if link directs to the current page 1758 1759 var urlL = location.href.replace(/\/#.*|#.*/, ''); 1760 var urlT = this.href.replace(/\/#.*|#.*/, ''); 1761 if( urlL == urlT ) e.preventDefault(); 1762 1763 var hash = this.hash; 1764 1765 // offset 1766 1767 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight(); 1768 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight(); 1769 1770 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1771 1772 // animate scroll 1773 1774 if( hash && $(hash).length ){ 1775 1776 $( 'html, body' ).animate({ 1777 scrollTop: $( hash ).offset().top - offset - fixStickyHeaderH() 1778 }, 500 ); 1779 } 1780 }); 1781 1782 1783 /* --------------------------------------------------------------------------- 1784 * Tabs 1785 * --------------------------------------------------------------------------- */ 1786 1787 $( '.jq-tabs' ).tabs(); 1788 1789 1790 /* --------------------------------------------------------------------------- 1791 * Accordion & FAQ 1792 * --------------------------------------------------------------------------- */ 1793 1794 $( '.mfn-acc' ).each( function(){ 1795 var el = $(this); 1796 1797 if( el.hasClass('openAll') ){ 1798 // show all ----------- 1799 1800 el.find('.question') 1801 .addClass("active") 1802 .children(".answer") 1803 .show(); 1804 1805 } else { 1806 // show one ----------- 1807 1808 var active_tab = el.attr('data-active-tab'); 1809 if( el.hasClass('open1st') ) active_tab = 1; 1810 1811 if( active_tab ){ 1812 el.find('.question').eq( active_tab - 1 ) 1813 .addClass("active") 1814 .children(".answer") 1815 .show(); 1816 } 1817 1818 } 1819 }); 1820 1821 $( '.mfn-acc .question > .title' ).click( function(){ 1822 1823 if($(this).parent().hasClass("active")) { 1824 1825 $(this).parent().removeClass("active").children(".answer").slideToggle(100); 1826 1827 } else { 1828 1829 if( ! $(this).closest('.mfn-acc').hasClass('toggle') ){ 1830 $(this).parents(".mfn-acc").children().each(function() { 1831 if($(this).hasClass("active")) { 1832 $(this).removeClass("active").children(".answer").slideToggle(100); 1833 } 1834 }); 1835 } 1836 $(this).parent().addClass("active"); 1837 $(this).next(".answer").slideToggle(100); 1838 1839 } 1840 1841 setTimeout( function(){ 1842 $( window ).trigger( 'resize' ); 1843 }, 50 ); 1844 1845 }); 1846 1847 // Visual Composer | Accordion | Sidebar height 1848 $( '.wpb_wrapper .vc_tta-panel-title' ).on( 'click', 'a', function(){ 1849 1850 setTimeout( function(){ 1851 $( window ).trigger( 'resize' ); 1852 }, 50 ); 1853 1854 }); 1855 1856 1857 /* --------------------------------------------------------------------------- 1858 * Helper 1859 * --------------------------------------------------------------------------- */ 1860 1861 $('.helper .link.toggle').click( function(e){ 1862 1863 e.preventDefault(); 1864 1865 var el = $(this); 1866 var id = el.attr('data-rel'); 1867 var parent = el.closest('.helper'); 1868 1869 if( el.hasClass('active') ){ 1870 1871 el.removeClass('active'); 1872 parent.find('.helper_content > .item-' + id ).removeClass('active').slideUp(200); 1873 1874 } else { 1875 1876 parent.find('.links > .link.active').removeClass('active'); 1877 parent.find('.helper_content > .item.active').slideUp(200); 1878 1879 el.addClass('active'); 1880 parent.find('.helper_content > .item-' + id ).addClass('active').slideDown(200); 1881 1882 } 1883 1884 setTimeout( function(){ 1885 $( window ).trigger( 'resize' ); 1886 }, 50 ); 1887 1888 }); 1889 1890 1891 /* --------------------------------------------------------------------------- 1892 * HTML5 Video | jPlayer 1893 * --------------------------------------------------------------------------- */ 1894 1895 function mfn_jPlayer(){ 1896 $('.mfn-jplayer').each(function(){ 1897 var m4v = $(this).attr('data-m4v'); 1898 var poster = $(this).attr('data-img');
1899 var swfPath = $(this).attr('data-swf'); 1900 var cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id'); 1901 1902 $(this).jPlayer({ 1903 ready : function () { 1904 $(this).jPlayer('setMedia', { 1905 m4v : m4v, 1906 poster : poster 1907 }); 1908 }, 1909 play : function () { // To avoid both jPlayers playing together. 1910 $(this).jPlayer('pauseOthers'); 1911 }, 1912 size: { 1913 cssClass : 'jp-video-360p', 1914 width : '100%', 1915 height : '360px' 1916 }, 1917 swfPath : swfPath, 1918 supplied : 'm4v', 1919 cssSelectorAncestor : cssSelectorAncestor, 1920 wmode : 'opaque' 1921 }); 1922 }); 1923 } 1924 mfn_jPlayer(); 1925 1926 1927 /* --------------------------------------------------------------------------- 1928 * Love 1929 * --------------------------------------------------------------------------- */ 1930 1931 $('.mfn-love').click(function() { 1932 var el = $( this ); 1933 if( el.hasClass( 'loved' ) ){ 1934 return false; 1935 } 1936 el.addClass( 'loved' ); 1937 1938 var post = { 1939 action: 'mfn_love', 1940 post_id: el.attr( 'data-id' ) 1941 }; 1942 1943 $.post( window.mfn_ajax, post, function( data ){ 1944 el.find( '.label' ).html( data ); 1945 }); 1946 1947 return false; 1948 }); 1949 1950 1951 /* --------------------------------------------------------------------------- 1952 * Go to top 1953 * --------------------------------------------------------------------------- */ 1954 1955 $('#back_to_top').click(function(){ 1956 $('body,html').animate({ 1957 scrollTop: 0 1958 }, 500); 1959 return false; 1960 }); 1961 1962 1963 /* --------------------------------------------------------------------------- 1964 * Section | Next v / Prev ^ arrows 1965 * --------------------------------------------------------------------------- */ 1966 1967 $('.section .section-nav').click(function(){ 1968 var el = $(this); 1969 var section = el.closest('.section'); 1970 1971 if( el.hasClass('prev') ){ 1972 // Previous Section ------------- 1973 if( section.prev().length ){ 1974 $('html, body').animate({ 1975 scrollTop: section.prev().offset().top 1976 }, 500); 1977 } 1978 } else { 1979 // Next Section ----------------- 1980 if( section.next().length ){ 1981 $('html, body').animate({ 1982 scrollTop: section.next().offset().top 1983 }, 500); 1984 } 1985 } 1986 }); 1987 1988 1989 /* --------------------------------------------------------------------------- 1990 * Intro | Scroll v arrow 1991 * --------------------------------------------------------------------------- */ 1992 1993 $('#Intro .intro-next').click(function(){ 1994 var intro = $(this).closest('#Intro'); 1995 1996 if( intro.next().length ){ 1997 $('html, body').animate({ 1998 scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH() 1999 }, 500); 2000 } 2001 }); 2002 2003 2004 /* --------------------------------------------------------------------------- 2005 * Widget | Muffin Menu | Hover on click 2006 * --------------------------------------------------------------------------- */ 2007 2008 $('.widget_mfn_menu ul.submenus-click').each(function(){ 2009 var el = $(this); 2010 $( 'a', el ).click(function(e){ 2011 var li = $(this).closest('li'); 2012 2013 if( li.hasClass('hover') || ! li.hasClass('menu-item-has-children') ){ 2014 // link click 2015 } else { 2016 e.preventDefault(); 2017 li.siblings('li').removeClass('hover') 2018 .find('li').removeClass('hover'); 2019 $(this).closest('li').addClass('hover'); 2020 } 2021 2022 }); 2023 }); 2024 2025 2026 /* --------------------------------------------------------------------------- 2027 * WooCommerce | Add to cart 2028 * --------------------------------------------------------------------------- */ 2029 2030 function addToCart(){ 2031 $('body').on('click', '.add_to_cart_button', function(){ 2032 $(this) 2033 .closest('.product') 2034 .addClass('adding-to-cart') 2035 .removeClass('added-to-cart'); 2036 }); 2037 2038 $('body').bind('added_to_cart', function() { 2039 $('.adding-to-cart') 2040 .removeClass('adding-to-cart') 2041 .addClass('added-to-cart'); 2042 }); 2043 } 2044 addToCart(); 2045 2046 2047 /* --------------------------------------------------------------------------- 2048 * Ajax | Complete 2049 * --------------------------------------------------------------------------- */ 2050 2051 $( document ).ajaxComplete( function() { 2052 2053 setTimeout( function(){ 2054 $( window ).trigger( 'resize' ); 2055 }, 100 ); 2056 2057 }); 2058 2059 2060 /* --------------------------------------------------------------------------- 2061 * Isotope 2062 * --------------------------------------------------------------------------- */ 2063 2064 // Isotope | Fiters ---------- 2065
2066 function isotopeFilter( domEl, isoWrapper ){ 2067 2068 var filter = domEl.attr('data-rel'); 2069 isoWrapper.isotope({ filter: filter }); 2070 2071 setTimeout( function(){ 2072 $( window ).trigger( 'resize' ); 2073 }, 50 ); 2074 2075 } 2076 2077 // Isotope | Fiters | Click ---------- 2078 2079 $('.isotope-filters .filters_wrapper').find('li:not(.close) a').click(function(e){ 2080 e.preventDefault(); 2081 2082 var isoWrapper = $('.isotope'); 2083 var filters = $(this).closest('.isotope-filters'); 2084 var parent = filters.attr('data-parent'); 2085 2086 if( parent ){ 2087 parent = filters.closest( '.' + parent ); 2088 isoWrapper = parent.find('.isotope').first(); 2089 } 2090 2091 filters.find('li').removeClass('current-cat'); 2092 $(this).closest('li').addClass('current-cat'); 2093 2094 isotopeFilter( $(this), isoWrapper ); 2095 2096 setTimeout( function(){ 2097 $( document ).trigger( 'isotope:arrange' ); 2098 }, 500 ); 2099 }); 2100 2101 2102 // Isotope | Fiters | Reset ---------- 2103 2104 $('.isotope-filters .filters_buttons').find('li.reset a').click(function(e){ 2105 e.preventDefault(); 2106 2107 $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat'); 2108 isotopeFilter( $(this), $('.isotope') ); 2109 }); 2110 2111 2112 2113 /* -------------------------------------------------------------------------------------------------------------------------- 2114 * 2115 * $( window ).resize | Debouncedresize 2116 * 2117 * ----------------------------------------------------------------------------------------------------------------------- */ 2118 2119 2120 $( window ).bind( 'debouncedresize', function(){ 2121 2122 2123 // Isotope | Relayout 2124 $( '.masonry.isotope' ).isotope(); 2125 $( '.masonry.gallery' ).isotope( 'layout' ); 2126 2127 // Sliding Footer | Height 2128 mfn_footer(); 2129 2130 // Header Width 2131 mfn_header(); 2132 2133 // Sidebar Height 2134 mfn_sidebar(); 2135 2136 // Full Screen Section 2137 mfn_sectionH(); 2138 2139 // Full Screen Intro 2140 mfn_introH(); 2141 2142 // niceScroll | Padding right fix for short content 2143 niceScrollFix(); 2144 2145 // Zoom Box | Vertical Align 2146 zoomBoxVerticalAlign(); 2147 2148 // Equal | Height 2149 mfn_equalH_wrap(); 2150 mfn_equalH(); 2151 2152 // Header Creative & Mobile Sticky 2153 creativeHeaderFix(); 2154 2155 }); 2156 2157 2158 2159 /* -------------------------------------------------------------------------------------------------------------------------- 2160 * 2161 * document.ready | Init 2162 * 2163 * ----------------------------------------------------------------------------------------------------------------------- */ 2164 2165 mfnSliderBlog(); 2166 mfnSliderClients(); 2167 mfnSliderOffer(); 2168 mfnSliderOfferThumb(); 2169 mfnSliderShop(); 2170 2171 sliderPortfolio(); 2172 sliderSlider(); 2173 sliderTestimonials(); 2174 2175 // Sidebar | Height 2176 mfn_sidebar(); 2177 2178 // Sliding Footer | Height 2179 mfn_footer(); 2180 2181 // Header | Width 2182 mfn_header(); 2183 2184 // Full Screen Section 2185 mfn_sectionH(); 2186 // Navigation | Hash 2187 hashNav(); 2188 2189 // Full Screen Intro 2190 mfn_introH(); 2191 2192 // Equal | Height 2193 mfn_equalH_wrap(); 2194 mfn_equalH(); 2195 }); 2196 2197 2198 2199 /* -------------------------------------------------------------------------------------------------------------------------- 2200 * 2201 * $( window ).scroll 2202 * 2203 * ----------------------------------------------------------------------------------------------------------------------- */ 2204 2205 2206 $( window ).scroll( function(){ 2207 2208 // Header | Sticky 2209 mfn_sticky(); 2210 2211 // Back to top | Sticky 2212 backToTopSticky(); 2213 2214 // One Page | Scroll | Active Section 2215 onePageActive(); 2216 2217 }); 2218 2219 2220 2221 /* -------------------------------------------------------------------------------------------------------------------------- 2222 * 2223 * $( window ).load 2224 * 2225 * ----------------------------------------------------------------------------------------------------------------------- */ 2226 2227 2228 $( window ).load( function(){ 2229 2230 2231 /* --------------------------------------------------------------------------- 2232 * Retina Logo 2233 * --------------------------------------------------------------------------- */ 2234 2235 function retinaLogo(){ 2236 if( window.devicePixelRatio > 1 ){ 2237 2238 var el = ''; 2239 var src = ''; 2240 var height = ''; 2241 2242 var parent = $( '#Top_bar #logo' ); 2243 var parentH = parent.data( 'height' ); 2244 2245 var maxH = { 2246 sticky : { 2247 init : 35, 2248 no_padding : 60, 2249 overflow : 110 2250 }, 2251 mobile : { 2252 mini : 50, 2253 mini_no_padding : 60 2254 }, 2255 mobile_sticky : { 2256 init : 50, 2257 no_padding : 60, 2258 overflow : 80 2259 } 2260 }; 2261 2262 $( '#Top_bar #logo img' ).each( function( index ){ 2263 2264 el = $( this ); 2265 src = el.data( 'retina' ); 2266 height = el.height(); 2267 2268 2269 // main ----- 2270 2271 if( el.hasClass( 'logo-main' ) ){ 2272 2273 if( $( 'body' ).hasClass( 'logo-overflow' ) ){ 2274 2275 // do nothing 2276 2277 } else if( height > parentH ){ 2278 2279 height = parentH; 2280 2281 } 2282 2283 } 2284 2285 // sticky ----- 2286 2287 if( el.hasClass( 'logo-sticky' ) ){ 2288 2289 if( $( 'body' ).hasClass( 'logo-overflow' ) ){ 2290 2291 if( height > maxH.sticky.overflow ){ 2292 height = maxH.sticky.overflow; 2293 } 2294 2295 } else if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){ 2296 2297 if( height > maxH.sticky.no_padding ){ 2298 height = maxH.sticky.no_padding; 2299 } 2300 2301 } else if( height > maxH.sticky.init ){ 2302 2303 height = maxH.sticky.init; 2304 2305 } 2306 2307 } 2308 2309 // mobile ----- 2310 2311 if( el.hasClass( 'logo-mobile' ) ){ 2312 2313 if( $( 'body' ).hasClass( 'mobile-header-mini' ) ){ 2314 2315 if( parent.data( 'padding' ) > 0 ){ 2316 2317 if( height > maxH.mobile.mini ){ 2318 height = maxH.mobile.mini; 2319 } 2320 2321 } else { 2322 2323 if( height > maxH.mobile.mini_no_padding ){ 2324 height = maxH.mobile.mini_no_padding; 2325 } 2326 2327 } 2328 2329 } 2330 2331 } 2332 2333 // mobile-sticky ----- 2334 2335 if( el.hasClass( 'logo-mobile-sticky' ) ){ 2336 2337 if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){ 2338 2339 if( height > maxH.mobile_sticky.no_padding ){ 2340 height = maxH.mobile_sticky.no_padding; 2341 } 2342 2343 } else if( height > maxH.mobile_sticky.init ){ 2344 height = maxH.mobile_sticky.init; 2345 } 2346 2347 } 2348 2349 2350 // SET 2351 2352 if( src ){ 2353 el.parent().addClass( 'retina' ); 2354 el.attr( 'src', src ).css( 'max-height', height + 'px' ); 2355 } 2356 2357 }); 2358 2359 } 2360 } 2361 retinaLogo(); 2362 2363 2364 /* --------------------------------------------------------------------------- 2365 * Isotope 2366 * --------------------------------------------------------------------------- */ 2367 2368 // Portfolio - Isotope 2369 $( '.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )' ).isotope({ 2370 itemSelector : '.isotope-item', 2371 layoutMode : 'fitRows', 2372 isOriginLeft : rtl ? false : true 2373 }); 2374 2375 // Portfolio - Masonry Flat 2376 $( '.portfolio_wrapper .masonry-flat' ).isotope({ 2377 itemSelector : '.isotope-item', 2378 percentPosition : true, 2379 masonry : { 2380 columnWidth: 1 2381 }, 2382 isOriginLeft : rtl ? false : true 2383 }); 2384 2385 // Blog & Portfolio - Masonry 2386 $( '.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal' ).isotope({ 2387 itemSelector : '.isotope-item', 2388 layoutMode : 'masonry', 2389 isOriginLeft : rtl ? false : true 2390 }); 2391 2392 // Portfolio | Active Category 2393 function portfolioActive(){ 2394 var el = $( '.isotope-filters .filters_wrapper' ); 2395 var active = el.attr( 'data-cat' ); 2396 2397 if( active ){ 2398 el.find( 'li.' + active ).addClass( 'current-cat' ); 2399 $( '.isotope' ).isotope({ filter: '.category-' + active }); 2400 } 2401 } 2402 portfolioActive(); 2403 2404 2405 /* --------------------------------------------------------------------------- 2406 * Chart 2407 * --------------------------------------------------------------------------- */ 2408 2409 $( '.chart' ).waypoint({ 2410 2411 offset : '100%', 2412 triggerOnce : true, 2413 handler : function(){ 2414 2415 var el = $( this.element ).length ? $( this.element ) : $( this ); 2416 var lineW = simple ? 4 : 8; 2417 2418 el.easyPieChart({ 2419 animate : 1000, 2420 lineCap : 'circle', 2421 lineWidth : lineW, 2422 size : 140, 2423 scaleColor : false, 2424 trackColor : '#f8f8f8' 2425 }); 2426 2427 if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){ 2428 this.destroy(); 2429 } 2430 } 2431 }); 2432 2433 2434 /* --------------------------------------------------------------------------- 2435 * Skills 2436 * --------------------------------------------------------------------------- */ 2437 2438 $( '.bars_list' ).waypoint({ 2439 2440 offset : '100%', 2441 triggerOnce : true, 2442 handler : function(){ 2443 2444 var el = $( this.element ).length ? $( this.element ) : $( this ); 2445 2446 el.addClass( 'hover' ); 2447 2448 if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){ 2449 this.destroy(); 2450 } 2451 } 2452 }); 2453 2454 2455 /* --------------------------------------------------------------------------- 2456 * Progress Icons 2457 * --------------------------------------------------------------------------- */ 2458 2459 $('.progress_icons').waypoint({ 2460 2461 offset : '100%', 2462 triggerOnce : true, 2463 handler : function(){ 2464 2465 var el = $( this.element ).length ? $( this.element ) : $( this ); 2466 var active = el.attr( 'data-active' ); 2467 var color = el.attr( 'data-color' ); 2468 var icon = el.find( '.progress_icon' ); 2469 var timeout = 200; // timeout in milliseconds 2470 2471 icon.each( function(i){ 2472 if( i < active ){ 2473 var time = ( i+1 ) * timeout; 2474 setTimeout( function(){ 2475 $( icon[i] ) 2476 .addClass( 'themebg' ) 2477 .css( 'background-color', color ); 2478 },time ); 2479 } 2480 }); 2481 2482 if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){ 2483 this.destroy(); 2484 } 2485 } 2486 }); 2487 2488 2489 /* --------------------------------------------------------------------------- 2490 * Animate Math | Counter, Quick Fact, etc. 2491 * --------------------------------------------------------------------------- */ 2492 2493 $('.animate-math .number').waypoint({ 2494 2495 offset : '100%', 2496 triggerOnce : true, 2497 handler : function(){ 2498 2499 var el = $( this.element ).length ? $( this.element ) : $( this ); 2500 var duration = Math.floor( ( Math.random() * 1000 ) + 1000 ); 2501 var to = el.attr( 'data-to' ); 2502 2503 $({ property:0 }).animate({ property:to }, { 2504 duration : duration, 2505 easing :'linear', 2506 step : function() { 2507 el.text( Math.floor( this.property ) ); 2508 }, 2509 complete : function() { 2510 el.text( this.property ); 2511 } 2512 }); 2513 2514 if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){ 2515 this.destroy(); 2516 } 2517 } 2518 }); 2519 2520 2521 /* --------------------------------------------------------------------------- 2522 * Before After | TwentyTwenty 2523 * --------------------------------------------------------------------------- */ 2524 2525 $('.before_after.twentytwenty-container').twentytwenty(); 2526 2527 2528 /* -------------------------------------------------------------------------------------------------------------------------- 2529 * 2530 * window.load | Init 2531 * 2532 * ----------------------------------------------------------------------------------------------------------------------- */ 2533 2534 // Header | Sticky 2535 mfn_stickyH(); 2536 mfn_sticky(); 2537 mfn_mobile_sticky(); 2538 2539 // Full Screen Section 2540 mfn_sectionH(); 2541 2542 // Navigation | Hash 2543 hashNav(); 2544 2545 // Full Screen Intro 2546 mfn_introH(); 2547 2548 // FIX | Revolution Slider Width & Height OnLoad 2549 $( window ).trigger( 'resize' ); 2550 2551 // Sidebar | Height 2552 setTimeout( function(){ 2553 mfn_sidebar(); 2554 }, 10 ); 2555 }); 2556 2557 2558 2559 /* -------------------------------------------------------------------------------------------------------------------------- 2560 * 2561 * $( document ).mouseup 2562 * 2563 * ----------------------------------------------------------------------------------------------------------------------- */ 2564 2565 2566 $( document ).mouseup(function(e){ 2567 2568 2569 // Widget | Muffin Menu | Hover on click 2570 if( $(".widget_mfn_menu ul.submenus-click").length ){ 2571 if( $(".widget_mfn_menu ul.submenus-click").has(e.target).length === 0 ){ 2572 $('.widget_mfn_menu ul.submenus-click li').removeClass('hover'); 2573 } 2574 } 2575 2576 2577 }); 2578 2579 2580 2581 /* -------------------------------------------------------------------------------------------------------------------------- 2582 * 2583 * Sliders configuration 2584 * 2585 * ----------------------------------------------------------------------------------------------------------------------- */ 2586 2587 2588 // Slick Slider | Auto responsive ----------------------------------------- 2589 2590 function slickAutoResponsive( slider, max, size ){ 2591 2592 if( ! max ) max = 5; 2593 if( ! size ) size = 380; 2594 2595 var width = slider.width();
2596 var count = Math.ceil( width / size ); 2597 2598 if( count < 1 ) count = 1; 2599 if( count > max ) count = max; 2600 2601 return count; 2602 } 2603 2604 2605 // --- Offer Thumb ----------------------------------------------------------------- 2606 2607 function mfnSliderOfferThumb(){ 2608 2609 var pager = function( el, i ){ 2610 var img = $( el.$slides[i] ).children( '.thumbnail' ).html(); 2611 return '<a>'+ img +'</a>'; 2612 }; 2613 2614 $('.offer_thumb_ul').each(function(){ 2615 2616 var slider = $(this); 2617 2618 slider.slick({ 2619 cssEase : 'ease-out', 2620 arrows : false, 2621 dots : true, 2622 infinite : true, 2623 touchThreshold : 10, 2624 speed : 300, 2625 2626 adaptiveHeight : true, 2627 appendDots : slider.siblings( '.slider_pagination' ), 2628 customPaging : pager, 2629 2630 rtl : rtl ? true : false, 2631 autoplay : window.mfn_sliders.offer ? true : false, 2632 autoplaySpeed : window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000, 2633 2634 slidesToShow : 1, 2635 slidesToScroll : 1 2636 }); 2637 2638 }); 2639 } 2640 2641 2642 // --- Offer ----------------------------------------------------------------- 2643 2644 function mfnSliderOffer(){ 2645 $('.offer_ul').each( function(){ 2646 2647 var slider = $(this); 2648 2649 slider.slick({ 2650 cssEase : 'ease-out', 2651 dots : false, 2652 infinite : true, 2653 touchThreshold : 10, 2654 speed : 300, 2655 2656 prevArrow : '<a class="button button_large button_js slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>', 2657 nextArrow : '<a class="button button_large button_js slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>', 2658 2659 adaptiveHeight : true, 2660 //customPaging : pager, 2661 2662 rtl : rtl ? true : false, 2663 autoplay : window.mfn_sliders.offer ? true : false, 2664 autoplaySpeed : window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000, 2665 2666 slidesToShow : 1, 2667 slidesToScroll : 1 2668 }); 2669 2670 // Pagination | Show (css) 2671 slider.siblings('.slider_pagination').addClass('show'); 2672 2673 // Pager | Set slide number after change 2674 slider.on( 'afterChange', function( event, slick, currentSlide, nextSlide ){ 2675 slider.siblings('.slider_pagination').find('.current').text( currentSlide + 1 ); 2676 }); 2677 2678 }); 2679 } 2680 2681 2682 // --- Shop ------------------------------------------------------------------ 2683 2684 function mfnSliderShop(){ 2685 2686 var pager = function( el, i ){ 2687 return '<a>'+ i +'</a>'; 2688 }; 2689 2690 $('.shop_slider_ul').each(function(){ 2691 2692 var slider = $(this); 2693 var slidesToShow = 4; 2694 2695 var count = slider.closest( '.shop_slider' ).data( 'count' ); 2696 if( slidesToShow > count ){ 2697 slidesToShow = count; 2698 if( slidesToShow < 1 ){ 2699 slidesToShow = 1; 2700 } 2701 } 2702 2703 slider.slick({ 2704 cssEase : 'ease-out', 2705 dots : true, 2706 infinite : true, 2707 touchThreshold : 10, 2708 speed : 300, 2709 2710 prevArrow : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2711 nextArrow : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2712 appendArrows : slider.siblings( '.blog_slider_header' ), 2713 2714 appendDots : slider.siblings( '.slider_pager' ), 2715 customPaging : pager, 2716 2717 rtl : rtl ? true : false, 2718 autoplay : window.mfn_sliders.shop ? true : false, 2719 autoplaySpeed : window.mfn_sliders.shop ? window.mfn_sliders.shop : 5000, 2720 2721 slidesToShow : slickAutoResponsive( slider, slidesToShow ), 2722 slidesToScroll : slickAutoResponsive( slider, slidesToShow ) 2723 }); 2724 2725 // Bind | debouncedresize 2726 $( window ).bind( 'debouncedresize', function(){ 2727 slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, slidesToShow ), false ); 2728 slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, slidesToShow ), true ); 2729 }); 2730 2731 }); 2732 } 2733 2734 2735 // --- Blog ------------------------------------------------------------------ 2736 2737 function mfnSliderBlog(){ 2738 2739 var pager = function( el, i ){ 2740 return '<a>'+ i +'</a>'; 2741 }; 2742 2743 $('.blog_slider_ul').each(function(){ 2744 2745 var slider = $(this); 2746 var slidesToShow = 4; 2747 2748 var count = slider.closest( '.blog_slider' ).data( 'count' ); 2749 if( slidesToShow > count ){ 2750 slidesToShow = count; 2751 if( slidesToShow < 1 ){ 2752 slidesToShow = 1; 2753 } 2754 } 2755 2756 slider.slick({ 2757 cssEase : 'ease-out', 2758 dots : true, 2759 infinite : true, 2760 touchThreshold : 10, 2761 speed : 300, 2762 2763 prevArrow : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2764 nextArrow : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2765 appendArrows : slider.siblings( '.blog_slider_header' ), 2766 2767 appendDots : slider.siblings( '.slider_pager' ), 2768 customPaging : pager, 2769 2770 rtl : rtl ? true : false, 2771 autoplay : window.mfn_sliders.blog ? true : false, 2772 autoplaySpeed : window.mfn_sliders.blog ? window.mfn_sliders.blog : 5000, 2773 2774 slidesToShow : slickAutoResponsive( slider, slidesToShow ), 2775 slidesToScroll : slickAutoResponsive( slider, slidesToShow ) 2776 }); 2777 2778 // Bind | debouncedresize 2779 $( window ).bind( 'debouncedresize', function(){ 2780 slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, slidesToShow ), false ); 2781 slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, slidesToShow ), true ); 2782 }); 2783 2784 }); 2785 } 2786 2787 2788 // --- Clients ------------------------------------------------------------------ 2789 2790 function mfnSliderClients(){ 2791 $('.clients_slider_ul').each(function(){ 2792 2793 var slider = $(this); 2794 2795 slider.slick({ 2796 cssEase : 'ease-out', 2797 dots : false, 2798 infinite : true, 2799 touchThreshold : 10, 2800 speed : 300, 2801 2802 prevArrow : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2803 nextArrow : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2804 appendArrows : slider.siblings( '.clients_slider_header' ), 2805 2806 rtl : rtl ? true : false, 2807 autoplay : window.mfn_sliders.clients ? true : false, 2808 autoplaySpeed : window.mfn_sliders.clients ? window.mfn_sliders.clients : 5000, 2809 2810 slidesToShow : slickAutoResponsive( slider, 4 ), 2811 slidesToScroll : slickAutoResponsive( slider, 4 ) 2812 }); 2813 2814 // Bind | debouncedresize 2815 $( window ).bind( 'debouncedresize', function(){ 2816 slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 4 ), false ); 2817 slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, 4 ), true ); 2818 }); 2819 2820 }); 2821 } 2822 2823 2824 // --- Portfolio ------------------------------------------------------------- 2825 2826 function sliderPortfolio(){ 2827 2828 $('.portfolio_slider_ul').each(function(){ 2829 2830 var slider = $(this); 2831 var size = 380; 2832 var scroll = 5; 2833 2834 if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){ 2835 size = slider.closest( '.portfolio_slider' ).data( 'size' ); 2836 } 2837 2838 if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){ 2839 scroll = slider.closest( '.portfolio_slider' ).data( 'scroll' ); 2840 } 2841 2842 slider.slick({ 2843 cssEase : 'ease-out', 2844 dots : false, 2845 infinite : true, 2846 touchThreshold : 10, 2847 speed : 300, 2848 2849 prevArrow : '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>', 2850 nextArrow : '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>', 2851 2852 rtl : rtl ? true : false, 2853 autoplay : window.mfn_sliders.portfolio ? true : false, 2854 autoplaySpeed : window.mfn_sliders.portfolio ? window.mfn_sliders.portfolio : 5000, 2855 2856 slidesToShow : slickAutoResponsive( slider, 5, size ), 2857 slidesToScroll : slickAutoResponsive( slider, scroll, size ) 2858 }); 2859 2860 // Bind | debouncedresize 2861 $( window ).bind( 'debouncedresize', function(){ 2862 slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 5, size ), false ); 2863 slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, scroll, size ), true ); 2864 }); 2865 2866 }); 2867 } 2868 2869 2870 // --- Slider ---------------------------------------------------------------- 2871 2872 function sliderSlider(){ 2873 2874 var pager = function( el, i ){ 2875 return '<a>'+ i +'</a>'; 2876 }; 2877 2878 $('.content_slider_ul').each(function(){ 2879 2880 var slider = $(this); 2881 var count = 1; 2882 var centerMode = false;
2883 2884 if( slider.closest( '.content_slider' ).hasClass( 'carousel' ) ){ 2885 count = slickAutoResponsive( slider ); 2886 2887 $( window ).bind( 'debouncedresize', function(){ 2888 slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider ), false ); 2889 slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider ), true ); 2890 }); 2891 } 2892 2893 if( slider.closest( '.content_slider' ).hasClass( 'center' ) ){ 2894 centerMode = true; 2895 } 2896 2897 slider.slick({ 2898 cssEase : 'cubic-bezier(.4,0,.2,1)', 2899 dots : true, 2900 infinite : true, 2901 touchThreshold : 10, 2902 speed : 300, 2903 2904 centerMode : centerMode, 2905 centerPadding : '20%', 2906 2907 prevArrow : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2908 nextArrow : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2909 2910 adaptiveHeight : true, 2911 appendDots : slider.siblings( '.slider_pager' ), 2912 customPaging : pager, 2913 2914 rtl : rtl ? true : false, 2915 autoplay : window.mfn_sliders.slider ? true : false, 2916 autoplaySpeed : window.mfn_sliders.slider ? window.mfn_sliders.slider : 5000, 2917 2918 slidesToShow : count, 2919 slidesToScroll : count 2920 }); 2921 2922 // Lightbox | disable on dragstart 2923 var clickEvent = false; 2924 2925 slider.on( 'dragstart', '.slick-slide a[rel="lightbox"]', function( event ){ 2926 if( lightbox_attr ){ 2927 var events = $( this ).data( 'events' ); 2928 clickEvent = events.click[0]; 2929 $( this ).addClass( 'unbind-click' ).unbind( 'click' ); 2930 } 2931 }); 2932 2933 // Lightbox | enable after change 2934 slider.on( 'afterChange', function( event, slick, currentSlide, nextSlide ){ 2935 if( lightbox_attr ){ 2936 $( 'a.unbind-click[rel="lightbox"]', slider ).removeClass( 'unbind-click' ).bind( 'click', clickEvent ); 2937 } 2938 }); 2939 2940 }); 2941 } 2942 2943 2944 // --- Testimonials ---------------------------------------------------------------- 2945 2946 function sliderTestimonials(){ 2947 2948 var pager = function( el, i ){ 2949 var img = $( el.$slides[i] ).find('.single-photo-img').html(); 2950 return '<a>'+ img +'</a>'; 2951 }; 2952 2953 $('.testimonials_slider_ul').each(function(){ 2954 2955 var slider = $(this); 2956 2957 slider.slick({ 2958 cssEase : 'ease-out', 2959 dots : true, 2960 infinite : true, 2961 touchThreshold : 10, 2962 speed : 300, 2963 2964 prevArrow : '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2965 nextArrow : '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2966 2967 adaptiveHeight : true, 2968 appendDots : slider.siblings( '.slider_pager' ), 2969 customPaging : pager, 2970 2971 rtl : rtl ? true : false, 2972 autoplay : window.mfn_sliders.testimonials ? true : false, 2973 autoplaySpeed : window.mfn_sliders.testimonials ? window.mfn_sliders.testimonials : 5000, 2974 2975 slidesToShow : 1, 2976 slidesToScroll : 1 2977 }); 2978 2979 }); 2980 } 2981 2982 2983})(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.