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