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