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