1/*-------------------------------------------------------------------------------------------------- 2 3 File: znscript.js 4 5 Description: This is the main javascript file for this theme 6 Please be careful when editing this file 7 8 --------------------------------------------------------------------------------------------------*/ 9(function ($) { 10 $.ZnThemeJs = function () { 11 this.scope = $(document); 12 this.zinit(); 13 }; 14 15 $.ZnThemeJs.prototype = { 16 zinit : function() { 17 var fw = this; 18 19 fw.addactions(); 20 // EVENTS THAT CAN BE REFRESHED 21 fw.refresh_events( $(document) ); 22 // $('.main-menu').ZnMegaMenu(); 23 fw.enable_responsive_menu(); 24 // Enable follow menu 25 fw.enable_follow_menu(); 26 }, 27 28 refresh_events : function( content ) { 29 30 var fw = this; 31 32 // FITVIDS 33 fw.enable_fitvids( content ); 34 35 // Enable menu offset - Prevents the submenus from existing the viewport 36 fw.enable_menu_offset(); 37 38 // Enable magnificpopup lightbox 39 fw.enable_magnificpopup( content ); 40 // Enable blog isotope 41 fw.enable_blog_isotope( content ); 42 43 // enable woocommerce lazy images 44 fw.enable_woo_lazyload( content ); 45 // Enable header sparckles 46 fw.enable_header_sparkles( content ); 47 // Enable hover borders 48 fw.enable_hoverborder( content ); 49 // Enable partners logo carousel 50 fw.enable_partners_logo_carousel( content ); 51 // Enable recent works carousel 52 fw.enable_recent_work_carousel( content ); 53 // ENABLE CONTACT FORMS 54 fw.enable_contact_forms(content); 55 // Enable circular carousel 56 fw.enable_circular_carousel( content ); 57 // Enable GENERAL slider 58 fw.enable_general_carousel( content ); 59 // Enable flickr feed 60 fw.enable_flickr_feed( content ); 61 // Enable iCarousel 62 fw.enable_icarousel( content ); 63 // Enable Ios Slider 64 fw.enable_ios_slider( content ); 65 // Enable Portfolio Slider 66 fw.enable_portfolio_slider( content ); 67 // Enable laptop slider 68 fw.enable_laptop_slider( content ); 69 // Enable latest posts css accordion 70 fw.enable_latest_posts_accordion( content ); 71 // Enable portfolio sortable 72 fw.enable_portfolio_sortable( content ); 73 // Enable Grid photo gallery 74 fw.enable_gridphotogallery( content ); 75 // Enable nivo slider 76 fw.enable_nivo_slider( content ); 77 // Enable recent works 2 78 fw.enable_recent_works2( content ); 79 // Enable recent works 3 80 fw.enable_recent_works3( content ); 81 // Enable Latest Posts Carousel 82 fw.enableLatestPostsCarousel(content); 83 // Enable ScreenShoot box 84 fw.enable_screenshoot_box( content ); 85 // Enable WOW slider 86 fw.enable_wow_slider( content ); 87 // Enable mailchimp subscribe 88 fw.enable_mailchimp_subscribe( content ); 89 // Enable testimonial fader 90 fw.enable_testimonial_fader( content ); 91 // Enable testimonial slider 92 fw.enable_testimonial_slider( content ); 93 // Enable shop limited offers 94 fw.enable_shop_limited_offers( content ); 95 // Enable Static content - showroom carousel
96 fw.enable_sc_showroomcarousel( content ); 97 // Enable Static content - Weather 98 fw.enable_static_weather( content ); 99 // Enable Partners Testimonials Carousel 100 fw.enable_testimonials_partners( content ); 101 // Enable IconBox 102 fw.enable_iconbox( content ); 103 // Enable Appeared Elements 104 fw.enable_appeared( content ); 105 // Enable SearchBox 106 fw.enable_searchbox( content ); 107 // Enable video elements 108 fw.enable_bg_video( content ); 109 // Enable toggle class 110 fw.enable_toggle_class( content ); 111 // Enable diagram 112 fw.enable_diagram(content); 113 // Enable services 114 fw.enable_services(content); 115 // Enable twitter fader 116 fw.enable_twitter_fader( content ); 117 118 fw.enable_shoplatest_presentation(content); 119 // enable scrollspy 120 fw.enable_scrollspy(content); 121 // enable bootstrap tooltips 122 fw.enable_tooltips(content); 123 124 fw.enable_customMenuDropdown(content); 125 fw.enable_portfolio_readmore(content); 126 127 }, 128 129 RefreshOnWidthChange : function(content) { 130 }, 131 132 addactions : function() { 133 var fw = this; 134 135 // Refresh events on new content 136 fw.scope.on('ZnWidthChanged',function(e){ 137 fw.RefreshOnWidthChange(e.content); 138 $(window).trigger('resize'); 139 }); 140 141 // Refresh events on new content 142 fw.scope.on('ZnNewContent',function(e){ 143 fw.refresh_events( e.content ); 144 }); 145 146 // Refresh events on new content 147 fw.scope.on('ZnBeforePlaceholderReplace',function(e){ 148 fw.unbind_events( e.content ); 149 }); 150 }, 151 152 unbind_events : function( scope ){ 153 // Remove iosSlider 154 var iosSliders = scope.find( '.iosSlider' ); 155 if( iosSliders.length > 0 ){ 156 iosSliders.each(function(){ 157 $(this).iosSlider('destroy'); 158 }); 159 } 160 }, 161 162 enable_woo_lazyload : function (scope){ 163 // Lazyload Woo Images 164 var elements = scope.find( 'img[data-src]' ); 165 elements.each(function(index, el) { 166 var $el = $(el); 167 $el.attr('src', $el.attr('data-src') ); 168 $el.imagesLoaded( function() { 169 $el.removeAttr('data-src'); 170 }); 171 }); 172 }, 173 174 enable_portfolio_readmore : function( scope ){ 175 var element = scope.find('.znprt_load_more_button'); 176 if (element.length === 0) { return; } 177 178 var fw = this; 179 180 element.on( 'click', function(e){ 181 182 e.preventDefault(); 183 184 var $this = $(this), 185 page = $this.data('page'), 186 ppp = $this.data('ppp'), 187 container = $this.parent().find( '#thumbs' ), 188 categories = $this.data('categories'); 189 190 if( $this.hasClass( 'zn_loadmore_disabled' ) ){ 191 return false; 192 } 193 194 $this.addClass( 'kl-ptfsortable-loadmore--loading' ); 195 196 $.post( ZnThemeAjax.ajaxurl, { 197 action:'zn_loadmore', 198 offset: page + 1, 199 ppp: ppp, 200 categories : categories 201 }).success(function( data ){ 202 $this.removeClass( 'kl-ptfsortable-loadmore--loading' ); 203 204 $this.data('page', page + 1); 205 if( data.length ){ 206 var newItems = $(data).appendTo(container); 207 fw.refresh_events( newItems ); 208 container.isotope( 'updateSortData', newItems ).isotope('appended', newItems ); 209 210 } 211 else{ 212 $this.addClass( 'zn_loadmore_disabled' ); 213 } 214 }); 215 }); 216 217 }, 218 219 /** 220 * Fixes submenus exiting the page on smaller screens 221 */ 222 enable_menu_offset : function(){ 223 224 $('#main-menu').find('ul li').on({ 225 "mouseenter.zn": function () { 226 var $submenu = $(this).children('.sub-menu').first(); 227 if ( $submenu.length > 0 ) { 228 var left_offset = $submenu.offset().left; 229 var width = $submenu.width(); 230 231 if( $('body').has('.boxed') ){ 232 var pagewidth = $('#page_wrapper').width(); 233 } 234 else{ 235 var pagewidth = $(window).width(); 236 } 237 238 239 if ((left_offset + width) > pagewidth) { 240 $submenu.addClass('zn_menu_on_left'); 241 } 242 } 243 }, 244 "mouseleave.zn": function () { 245 var $submenu = $(this).children('ul').first(); 246 $submenu.removeClass('zn_menu_on_left'); 247 } 248 }); 249 }, 250 251 enable_fitvids : function ( scope ) { 252 253 var element = scope.find('.zn_iframe_wrap, .zn_pb_wrapper'); 254 if (element.length === 0) { return; } 255 256 element.fitVids({ ignore: '.no-adjust'}); 257 258 }, 259 260 enable_contact_forms : function ( scope ) 261 { 262 var fw = this, 263 element = (scope) ? scope.find('.zn_contact_form_container > form') : $('.zn_contact_form_container > form'); 264 265 element.each(function(index, el) { 266 267 $(el).on( 'submit', function(e){ 268 269 e.preventDefault(); 270 271 if ( fw.form_submitting === true ) { return false; } 272 273 fw.form_submitting = true; 274 275 var form = $(this), 276 response_container = form.find('.zn_contact_ajax_response:eq(0)'), 277 has_error = false, 278 inputs = 279 { 280 fields : form.find('textarea, select, input[type=text], input[type=checkbox], input[type=hidden]') 281 }, 282 form_id = response_container.attr('id'), 283 submit_button = form.find('.zn_contact_submit'); 284 285 // FADE THE BUTTON 286 submit_button.addClass('zn_form_loading'); 287 288 // PERFORM A CHECK ON ELEMENTS : 289 inputs.fields.each(function() 290 { 291 var field = $(this), 292 p_container = field.parent(); 293 294 // Set the proper value for checkboxes 295 if(field.is(':checkbox')) 296 { 297 if(field.is(':checked')) { field.val(true) } else { field.val('') } 298 } 299 300 p_container.removeClass('zn_field_not_valid'); 301 302 // Check fields that needs to be filled 303 if ( field.hasClass('zn_validate_not_empty') ) { 304 if( field.is(':checkbox') ){ 305 if( ! field.is(':checked') ){ 306 p_container.addClass('zn_field_not_valid'); 307 has_error = true; 308 } 309 } 310 else { 311 if ( field.val() === '' ){ 312 p_container.addClass('zn_field_not_valid'); 313 has_error = true; 314 } 315 } 316 } 317 else if ( field.hasClass('zn_validate_is_email') ) { 318 if ( !field.val().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/) ) 319 { 320 p_container.addClass('zn_field_not_valid'); 321 has_error = true; 322 } 323 } 324 }); 325 326 if ( has_error ) 327 { 328 submit_button.removeClass('zn_form_loading'); 329 fw.form_submitting = false;
330 return false; 331 } 332 333 response_container.load( form.attr('action')+' #'+form_id +' > .zn_cf_response' , inputs.fields , function() 334 { 335 // DO SOMETHING 336 fw.form_submitting = false; 337 submit_button.removeClass('zn_form_loading'); 338 339 // Perform the redirect if the form was valid 340 var response = $('#'+form_id +' > .zn_cf_response'), 341 redirect_uri = form.data( 'redirect' ); 342 343 // If the form was successfull 344 if( response.hasClass('alert-success') ){ 345 inputs.fields.val(''); 346 if( redirect_uri ){ 347 window.location.replace(redirect_uri); 348 } 349 } 350 351 352 }); 353 354 return false; 355 356 }); 357 }); 358 359 }, 360 361 /* Button to toggle a class 362 * example: class="js-toggle-class" data-target=".kl-contentmaps__panel" data-target-class="is-closed" 363 */ 364 enable_toggle_class : function( scope ){ 365 var elements = scope.find( '.js-toggle-class' ); 366 elements.each(function(index, el) { 367 var $el = $(el); 368 $(el).on('click',function (e) { 369 e.preventDefault(); 370 371 $(el).toggleClass('is-toggled'); 372 373 var target = $el.attr('data-target'), 374 target_class = $el.attr('data-target-class') ? $el.attr('data-target-class') : ''; 375 if(target && target.length){ 376 $(target).toggleClass(target_class); 377 } 378 }); 379 }); 380 }, 381 382 enable_blog_isotope : function( scope ){ 383 var elements = scope.find( '.zn_blog_columns' ); 384 385 if( elements.length == 0) { return; } 386 elements.imagesLoaded( function() { 387 elements.isotope({ 388 itemSelector: ".blog-isotope-item", 389 animationEngine: "jquery", 390 animationOptions: { 391 duration: 250, 392 easing: "easeOutExpo", 393 queue: false 394 }, 395 filter: '', 396 sortAscending: true, 397 sortBy: '' 398 }); 399 }); 400 }, 401 402 /** 403 * Easy Video Background 404 * Based on easy background video plugin 405 * Example data setup attribute: 406 * @since 4.0 407 * data-setup='{ "position": absolute, "loop": true , "autoplay": true, "muted": true, "mp4":"", "webm":"", "ogg":"" }' 408 */ 409 enable_bg_video : function( scope ){ 410 var fw = this, 411 elements = scope.find('.kl-video'); 412 413 elements.each(function(index, el) { 414 var $video = $(el), 415 _vid_controls = $video.next('.kl-video--controls'), 416 _vid_playplause = _vid_controls.find('.btn-toggleplay'), 417 _vid_audio = _vid_controls.find('.btn-audio'), 418 _data_attribs = $video.attr("data-setup"), 419 _options = typeof _data_attribs != 'undefined' ? JSON.parse(_data_attribs) : '{}'; 420 421 if(_options.height_container == true) 422 $video.closest('.kl-video-container').css('height', $video.height()); 423 424 if(_options.hasOwnProperty('muted') && _options.muted == true) _vid_audio.children('i').addClass('mute'); 425 if(_options.hasOwnProperty('autoplay') && _options.autoplay == false) _vid_playplause.children('i').addClass('paused'); 426 427 if(typeof video_background != 'undefined') { 428 var Video_back = new video_background( $video, 429 { 430 //Stick within the div or fixed 431 "position": _options.hasOwnProperty('position') ? _options.position : "absolute", 432 //Behind everything 433 "z-index": _options.hasOwnProperty('zindex') ? _options.zindex : "-1", 434 435 //Loop when it reaches the end 436 "loop": _options.hasOwnProperty('loop') ? _options.loop : true, 437 //Autoplay at start 438 "autoplay": _options.hasOwnProperty('autoplay') ? _options.autoplay : false, 439 //Muted at start 440 "muted": _options.hasOwnProperty('muted') ? _options.muted : true, 441 442 //Path to video mp4 format 443 "mp4": _options.hasOwnProperty('mp4') ? _options.mp4 : false, 444 //Path to video webm format 445 "webm": _options.hasOwnProperty('webm') ? _options.webm : false, 446 //Path to video ogg/ogv format 447 "ogg": _options.hasOwnProperty('ogg') ? _options.ogg : false, 448 //Path to video flv format 449 "flv": _options.hasOwnProperty('flv') ? _options.flv : false, 450 //Fallback image path 451 "fallback_image": _options.hasOwnProperty('fallback_image') ? _options.fallback_image : false, 452 // Youtube Video ID 453 "youtube": _options.hasOwnProperty('youtube') ? _options.youtube : false, 454 455 // flash || html5 456 "priority": _options.hasOwnProperty('priority') ? _options.priority : "html5", 457 // width/height -> If none provided sizing of the video is set to adjust 458 "video_ratio": _options.hasOwnProperty('video_ratio') ? _options.video_ratio : false, 459 // fill || adjust 460 "sizing": _options.hasOwnProperty('sizing') ? _options.sizing : "fill", 461 // when to start 462 "start": _options.hasOwnProperty('start') ? _options.start : 0 463 }); 464 //Toggle play status 465 _vid_playplause.on('click',function(e){ 466 e.preventDefault(); 467 Video_back.toggle_play(); 468 $(this).children('i').toggleClass('paused'); 469 }); 470 //Toggle mute 471 _vid_audio.on('click',function(e){ 472 e.preventDefault(); 473 Video_back.toggle_mute(); 474 $(this).children('i').toggleClass('mute'); 475 }); 476 } 477 }); 478 479 }, 480 481 enable_follow_menu : function(){ 482 var doc = $(document), 483 header = $('header#header'), 484 chaser = $('#main-menu > ul'), 485 forch = 300, 486 visible = false;
487 488 if( ! header.hasClass( 'header--follow' ) || Modernizr.touch ){ 489 return false; 490 } 491 492 if(chaser && chaser.length > 0) { 493 494 chaser.clone() 495 .appendTo(document.body) 496 .wrap('<div class="chaser"><div class="container"><div class="row"><div class="col-md-12"></div></div></div></div>') 497 .addClass('chaser-main-menu'); 498 499 var _chaser = $('body .chaser'); 500 501 if(header && header.length > 0 ) { 502 forch = header.offset().top + header.outerHeight(true); 503 } 504 505 if(doc.scrollTop() > forch) { 506 _chaser.addClass('visible'); 507 visible = true; 508 } 509 510 $(window).on('scroll', function() { 511 if (!visible && doc.scrollTop() > forch ) { 512 _chaser.addClass('visible'); 513 visible = true; 514 } 515 else if (visible && doc.scrollTop() < forch ) { 516 _chaser.removeClass('visible'); 517 visible = false; 518 } 519 }); 520 521 } 522 }, 523 524 enable_responsive_menu : function(){ 525 526 var fw = this, 527 page_wrapper = $('#page_wrapper'), 528 responsive_trigger = $('.zn-res-trigger'), 529 menu_activated = false, 530 back_text = '<li class="zn_res_menu_go_back"><span class="zn_res_back_icon glyphicon glyphicon-chevron-left"></span><a href="#">'+ZnThemeAjax.zn_back_text+'</a></li>', 531 cloned_menu = $('#main-menu > ul').clone().attr({id:"zn-res-menu", "class":"zn-res-menu-nav"}); 532 533 var start_responsive_menu = function() 534 { 535 536 var responsive_menu = cloned_menu.prependTo(page_wrapper); 537 538 // BIND OPEN MENU TRIGGER 539 responsive_trigger.click(function(e){ 540 e.preventDefault(); 541 responsive_menu.addClass('zn-menu-visible'); 542 set_height(); 543 }); 544 545 // Close the menu when a link is clicked 546 responsive_menu.find( 'a:not([rel*="mfp-"])' ).on('click',function(e){ 547 $( '.zn_res_menu_go_back' ).first().trigger( 'click' ); 548 }); 549 550 // ADD ARROWS TO SUBMENUS TRIGGERS 551 responsive_menu 552 .find('li:has(> ul.sub-menu), li:has(> div.zn_mega_container)') 553 .addClass('zn_res_has_submenu') 554 .prepend('<span class="zn_res_submenu_trigger glyphicon glyphicon-chevron-right"></span>'); 555 // ADD BACK BUTTONS 556 responsive_menu 557 .find('.zn_res_has_submenu > ul.sub-menu, .zn_res_has_submenu > div.zn_mega_container') 558 .addBack() 559 .prepend(back_text); 560 561 // REMOVE BACK BUTTON LINK 562 $( '.zn_res_menu_go_back' ).click(function(e){ 563 e.preventDefault(); 564 var active_menu = $(this).closest('.zn-menu-visible'); 565 active_menu.removeClass('zn-menu-visible'); 566 set_height(); 567 if( active_menu.is('#zn-res-menu') ) { 568 page_wrapper.css({'height':'auto'}); 569 } 570 }); 571 572 // OPEN SUBMENU'S ON CLICK 573 $('.zn_res_submenu_trigger').on('click',function(e){ 574 e.preventDefault(); 575 $(this).siblings('ul,.zn_mega_container').addClass('zn-menu-visible'); 576 set_height(); 577 }); 578 }; 579 580 var set_height = function(){ 581 var _menu = $('.zn-menu-visible').last(), 582 height = _menu.css({height:'auto'}).outerHeight(true), 583 window_height = $(window).height(), 584 adminbar_height = 0, 585 admin_bar = $('#wpadminbar'); 586 587 // CHECK IF WE HAVE THE ADMIN BAR VISIBLE 588 if(height < window_height) { 589 height = window_height; 590 if ( admin_bar.length > 0 ) { 591 adminbar_height = admin_bar.outerHeight(true); 592 height = height - adminbar_height; 593 } 594 } 595 _menu.attr('style',''); 596 page_wrapper.css({'height':height}); 597 }; 598 599 // MAIN TRIGGER FOR ACTIVATING THE RESPONSIVE MENU 600 $( window ).on( 'debouncedresize' , function(){ 601 if ( $(window).width() < ZnThemeAjax.res_menu_trigger ) { 602 if ( !menu_activated ){ 603 start_responsive_menu(); 604 menu_activated = true; 605 fw.refresh_events( cloned_menu ); 606 } 607 page_wrapper.addClass('zn_res_menu_visible'); 608 } 609 else{ 610 // WE SHOULD HIDE THE MENU 611 $('.zn-menu-visible').removeClass('zn-menu-visible'); 612 page_wrapper.css({'height':'auto'}).removeClass('zn_res_menu_visible'); 613 } 614 // Fix for triggering the responsive menu 615 }).trigger('debouncedresize'); 616 }, 617 618 enable_header_sparkles : function( content ){ 619 620 var sparkles = content.find('.th-sparkles:visible'); 621 if( sparkles.length == 0 ){ return false; } 622 623 sparkles.each(function(){ 624 if ($.browser.msie && $.browser.version < 9) { 625 return 626 } 627 var a = 40, 628 i = 0; 629 for (i; i < a; i++) { 630 new Spark( $(this) ); 631 } 632 633 }); 634 635 }, 636 637 enable_magnificpopup : function( content ) 638 { 639 if(typeof($.fn.magnificPopup) != 'undefined') 640 { 641 $('a.kl-login-box').magnificPopup({ 642 type: 'inline', 643 closeBtnInside:true, 644 showCloseBtn: true, 645 mainClass: 'mfp-fade mfp-bg-lighter' 646 }); 647 648 $('a[data-lightbox="image"]:not([data-type="video"]), .mfp-image').each(function(i,el){ 649 //single image popup 650 if ($(el).parents('.gallery').length == 0) { 651 $(el).magnificPopup({ 652 type:'image', 653 tLoading: '', 654 mainClass: 'mfp-fade' 655 }); 656 } 657 }); 658 $('.mfp-gallery.mfp-gallery--images').each(function(i,el) { 659 $(el).magnificPopup({ 660 delegate: 'a', 661 type: 'image', 662 gallery: {enabled:true}, 663 tLoading: '', 664 mainClass: 'mfp-fade' 665 }); 666 }); 667 // Notice the .misc class, this is a gallery which contains a variatey of sources 668 // links in gallery need data-mfp attributes eg: data-mfp="image" 669 $('.mfp-gallery.mfp-gallery--misc a[data-lightbox="mfp"]').magnificPopup({ 670 mainClass: 'mfp-fade', 671 type: 'image', 672 gallery: {enabled:true}, 673 tLoading: '', 674 callbacks: { 675 elementParse: function(item) { 676 item.type = $(item.el).attr('data-mfp'); 677 } 678 } 679 }); 680 $('a[data-lightbox="iframe"], a[rel="mfp-iframe"]').magnificPopup({type: 'iframe', mainClass: 'mfp-fade', tLoading: ''}); 681 $('a[data-lightbox="inline"], a[rel="mfp-inline"]').magnificPopup({type: 'inline', mainClass: 'mfp-fade', tLoading: ''}); 682 $('a[data-lightbox="ajax"], a[rel="mfp-ajax"]').magnificPopup({type: 'ajax', mainClass: 'mfp-fade', tLoading: ''}); 683 $('a[data-lightbox="youtube"], a[data-lightbox="vimeo"], a[data-lightbox="gmaps"], a[data-type="video"], a[rel="mfp-media"]').magnificPopup({ 684 disableOn: 700, 685 type: 'iframe', 686 removalDelay: 160, 687 preloader: true,
688 fixedContentPos: false, 689 mainClass: 'mfp-fade', 690 tLoading: '' 691 }); 692 693 // Dynamic inline modal 694 // Will pass the title attribute to a dynamic field in a form 695 $('a[data-lightbox="inline-dyn"]').magnificPopup({ 696 type: 'inline', 697 mainClass: 'mfp-fade', 698 callbacks: { 699 open: function() { 700 701 var inst = $.magnificPopup.instance, 702 form = $(inst.content).find('form'), 703 itemTitle = inst.ev.attr('title'); 704 705 if($(form).length > 0 && itemTitle != ''){ 706 var dynamicField = form.first().find('.zn-field-dynamic'); 707 if($(dynamicField).length > 0){ 708 $(dynamicField).first().val(itemTitle).attr('readonly', 'readonly'); 709 } 710 } 711 712 }, 713 } 714 }); 715 716 // Enable WooCommerce lightbox 717 $('.single_product_main_image .images a').magnificPopup({ 718 mainClass: 'mfp-fade', 719 type: 'image', 720 gallery: {enabled:true}, 721 tLoading: '', 722 }); 723 724 // Auto-Popup Modal Window - Immediately 725 // Options located in Section element > Advanced 726 $('body:not(.zn_pb_editor_enabled) .zn_section--auto-immediately').each(function(index, el) { 727 $.magnificPopup.open({ 728 items: { 729 src: $(el), 730 type: 'inline' 731 }, 732 mainClass: 'mfp-fade' 733 }); 734 }); 735 736 // Auto-Popup Modal Window - On Scroll 737 // Options located in Section element > Advanced 738 $('body:not(.zn_pb_editor_enabled) .zn_section--auto-scroll').each(function(index, el) { 739 var isAppeared = false; 740 $(window).on('scroll', function(){ 741 if( $(window).scrollTop() > ($(document).outerHeight()/2) && isAppeared == false){ 742 $.magnificPopup.open({ 743 items: { 744 src: $(el), 745 type: 'inline' 746 }, 747 mainClass: 'mfp-fade' 748 }); 749 isAppeared = true; 750 } 751 }); 752 }); 753 754 // Auto-Popup Modal Window - On X seconds Delay 755 // Options located in Section element > Advanced 756 $('body:not(.zn_pb_editor_enabled) .zn_section--auto-delay').each(function(index, el) { 757 var isAppeared = false, 758 delay = $(el).is("[data-auto-delay]") ? parseInt( $(el).attr("data-auto-delay") ) : 5; 759 setTimeout(function(){ 760 $.magnificPopup.open({ 761 items: { 762 src: $(el), 763 type: 'inline' 764 }, 765 mainClass: 'mfp-fade' 766 }); 767 isAppeared = true; 768 }, delay*1000); 769 }); 770 771 } 772 }, 773 774 enable_hoverborder : function( content ){ 775 var hoverBorders = content.find('.hoverBorder'); 776 // TODO: Remove if all ok with only-css hoverBorder 777 // if(hoverBorders && hoverBorders.length > 0){ 778 // hoverBorders.each(function () { 779 // $(this) 780 // .find('img, .hoverborder-img') 781 // .wrap('<span class="hoverBorderWrapper"/>') 782 // .after('<span class="theHoverBorder"></span>'); 783 // }); 784 // } 785 }, 786 787 enable_partners_logo_carousel : function( content ){ 788 var elements = content.find('.partners_carousel_trigger'); 789 if(elements && elements.length){ 790 $.each(elements, function(i, e){ 791 var self = $(e); 792 if(typeof($.fn.carouFredSel) != 'undefined') { 793 self.imagesLoaded( function() { 794 self.carouFredSel({ 795 responsive: true, 796 scroll: 1, 797 auto: self.data('autoplay'), 798 items: { 799 width: 250, 800 visible: { min: 3, max: 10 } 801 }, 802 prev : { 803 button : function(){return self.parents('.partners_carousel').find('.prev');}, 804 key : "left" 805 }, 806 next : { 807 button : function(){return self.parents('.partners_carousel').find('.next');}, 808 key : "right" 809 } 810 }); 811 }); 812 } 813 }); 814 } 815 }, 816 817 enable_recent_work_carousel : function( content ){ 818 var elements = content.find('.recent_works1'); 819 if(elements && elements.length){ 820 $.each(elements, function(i, e){ 821 var self = $(e); 822 if(typeof($.fn.carouFredSel) != 'undefined') { 823 824 var autoplay = self.attr('data-autoplay') ? parseInt(self.data('autoplay')) : 0, 825 timeout = self.attr('data-timeout') ? parseInt(self.data('timeout')) : 5000; 826 827 var options = { 828 responsive: true, 829 scroll: 1,
830 auto: false, 831 items: { 832 width: 300, 833 visible: { min: 1, max: 3 } 834 }, 835 prev : { 836 button : function(){return self.closest('.recentwork_carousel').find('.prev');}, 837 key : "left" 838 }, 839 next : { 840 button : function(){return self.closest('.recentwork_carousel').find('.next');}, 841 key : "right" 842 } 843 }; 844 if(autoplay > 0 && timeout >= 100){ 845 options['auto'] = true; 846 options['timeoutDuration'] = timeout; 847 } 848 849 self.carouFredSel(options); 850 } 851 }); 852 } 853 }, 854 855 enable_circular_carousel : function( content ) 856 { 857 var cirContentContainer = content.find('.ca-container'), 858 elements = cirContentContainer.children('.ca-wrapper'); 859 860 // do the carousel 861 if(elements && elements.length > 0 ) { 862 $.each(elements, function(i, e){ 863 var self = $(e), 864 autoplay = (self.attr('data-autoplay') == '1'); 865 866 if(typeof($.fn.carouFredSel) != 'undefined') { 867 self.carouFredSel({ 868 responsive: true, 869 width: '1170', 870 height: 450, 871 direction : "left", 872 items: { 873 width: 550, 874 visible: { 875 min: 1, 876 max: 3 877 } 878 }, 879 auto: { 880 play: autoplay 881 }, 882 scroll : { 883 items : 1, 884 easing : "easeInOutExpo", 885 duration : 1000, 886 pauseOnHover : true, 887 timeoutDuration : parseFloat( self.attr('data-timout') ) 888 }, 889 prev : { 890 button : self.closest('.ca-container').find('.ca-nav-prev'), 891 key : "left" 892 }, 893 next : { 894 button : self.closest('.ca-container').find('.ca-nav-next'), 895 key : "right" 896 }, 897 swipe: { 898 onTouch: true, 899 onMouse: true 900 } 901 }); 902 } 903 // Open wrapper panel 904 var opened = false; 905 self.find('.js-ca-more').on('click', function(e){ 906 e.preventDefault(); 907 var th = $(this).closest('.ca-item'), 908 thpos = th.position().left; 909 910 if(!opened){ 911 self.trigger('stop'); 912 self.closest('.ca-container').addClass('ca--is-rolling'); 913 th.addClass('ca--opened'); 914 th.css({ 915 "-webkit-transform":"translateX(-"+ thpos +"px)", 916 "-ms-transform":"translateX(-"+ thpos +"px)", 917 "transform":"translateX(-"+ thpos +"px)" 918 }); 919 opened = true; 920 921 } else if(opened){ 922 923 if($(this).hasClass('js-ca-more-close')){ 924 925 self.trigger('play', true); 926 self.closest('.ca-container').removeClass('ca--is-rolling'); 927 th.removeClass('ca--opened'); 928 th.css({ 929 "-webkit-transform":"translateX(0)", 930 "-ms-transform":"translateX(0)", 931 "transform":"translateX(0)" 932 }); 933 opened = false; 934 } 935 } 936 }); 937 // Close wrapper panel 938 self.find('.js-ca-close').on('click', function(e){ 939 e.preventDefault(); 940 var th = $(this).closest('.ca-item'); 941 if(opened){ 942 self.trigger('play', true); 943 self.closest('.ca-container').removeClass('ca--is-rolling'); 944 th.removeClass('ca--opened'); 945 th.css({ 946 "-webkit-transform":"translateX(0)", 947 "-ms-transform":"translateX(0)", 948 "transform":"translateX(0)" 949 }); 950 } 951 opened = false; 952 }); 953 }); 954 955 } 956 }, 957 958 enable_general_carousel : function( content ){ 959 var elements = content.find('.zn_general_carousel'), 960 fw = this; 961 962 if(elements && elements.length) 963 { 964 if(typeof($.fn.carouFredSel) != 'undefined') { 965 jQuery.each(elements, function(i, e){ 966 967 var $el = $(e); 968 969 var highlight = function(data) { 970 var item = $el.triggerHandler('currentVisible'); 971 $el.children('.cfs--item').removeClass('cfs--active-item'); 972 item.addClass('cfs--active-item'); 973 }; 974 var unhighlight = function(data) { 975 $el.children('.cfs--item').removeClass('cfs--active-item'); 976 }; 977 978 // Set the carousel defaults 979 var defaults = { 980 fancy: false 981 , transition : 'fade' 982 , direction : 'left' 983 , responsive: true 984 , auto: true 985 , items: { 986 visible: 1 987 } 988 , scroll: { 989 fx: 'fade' 990 , timeoutDuration : 9000 991 , easing: 'swing' 992 , onBefore : unhighlight 993 , onAfter: highlight 994 } 995 , swipe: { 996 onTouch: true, 997 onMouse: true 998 } 999 , pagination: { 1000 container: $el.parent().find('.cfs--pagination'), 1001 anchorBuilder: function(nr, item) { 1002 var thumb = ''; 1003 if( $el.is("[data-thumbs]") && $el.data('thumbs') == 'zn_has_thumbs' ){ 1004 var items = $el.children('li'); 1005 thumb = 'style="background-image:url('+ items.eq(nr-1).attr('data-thumb') + ');"'; 1006 } 1007 return '<a href="#'+nr+'" '+ thumb +'></a>'; 1008 } 1009 } 1010 , next : { 1011 button: $el.parent().find('.cfs--next'), 1012 key: 'right' 1013 } 1014 , prev : { 1015 button: $el.parent().find('.cfs--prev'), 1016 key: 'left' 1017 } 1018 , onCreate : highlight 1019 } 1020 1021 if( $el.is("[data-fancy]") ) 1022 defaults.fancy = $el.data('fancy'); 1023 1024 // Get the custom carousel settings from data attributes 1025 var customSettings = { 1026 scroll: { 1027 fx : $el.is("[data-transition]") ? $el.data('transition') : defaults.transition 1028 , timeoutDuration : $el.is("[data-timout]") ? parseFloat( $el.data('timout') ) : defaults.scroll.timeoutDuration 1029 , easing: $el.is("[data-easing]") ? $el.data('easing') : defaults.scroll.easing 1030 , onBefore : unhighlight 1031 , onAfter: highlight 1032 } 1033 , auto: { 1034 play: $el.is('[data-autoplay]') && $el.attr('data-autoplay') == '1' ? defaults.auto : false 1035 } 1036 , direction: $el.is("[data-direction]") ? $el.data('direction') : defaults.direction 1037 }; 1038 1039 // Special case/callback for the fancy slider 1040 if ( defaults.fancy ) { 1041 // var callback = window['slideCompleteFancy'](); 1042 $.extend(customSettings.scroll, { 1043 onBefore : function(e){ slideCompleteFancy(e, $el) }, 1044 onAfter : function(e){ slideCompleteFancy(e, $el) }, 1045 }); 1046 } 1047 1048 // Callback function for fancy slider 1049 function slideCompleteFancy(args, slider) { 1050 var _arg = $(slider), 1051 slideshow = $(slider).closest('.kl-slideshow'), 1052 color = $(args.items.visible).attr('data-color'); 1053 1054 // slideshow.animate({backgroundColor: color}, 400); 1055 slideshow.css({backgroundColor: color}); 1056 } 1057 1058 // Start the carousel already :) 1059 $el.imagesLoaded( function() { 1060 $el.carouFredSel($.extend({}, defaults, customSettings)); 1061 }); 1062 1063 // fix for up/down direction not riszing the slider 1064 if( defaults.fancy ){ 1065 $( window ).on( 'debouncedresize' , function(){ 1066 if( $(window).width() < 1199 ){ 1067 $el.trigger("configuration", ["direction", "left"]); 1068 } else { 1069 $el.trigger("configuration", ["direction", "up"]); 1070 } 1071 $el.trigger('updateSizes'); 1072 }); 1073 } 1074 }); 1075 } 1076 1077 return false;
1078 1079 } 1080 }, 1081 1082 enable_flickr_feed : function( content ){ 1083 var elements = content.find('.flickr_feeds'); 1084 if(elements && elements.length){ 1085 $.each(elements, function(i, e){ 1086 var self = $(e), 1087 ff_limit = (self.attr('data-limit') ? self.attr('data-limit') : 6), 1088 fid = self.attr('data-fid'); 1089 if(typeof($.fn.jflickrfeed) != 'undefined') { 1090 self.jflickrfeed({ 1091 limit: ff_limit, 1092 qstrings: { id: fid }, 1093 itemTemplate: '<li class="flickrfeed-item"><a href="{{image_b}}" class="flickrfeed-link hoverBorder" data-lightbox="image"><img src="{{image_s}}" alt="{{title}}" class="flickrfeed-img" /></a></li>' 1094 }, 1095 function(data) { 1096 self.find(" a[data-lightbox='image']").magnificPopup({type:'image', tLoading: ''}); 1097 self.parent().removeClass('loading'); 1098 }); 1099 } 1100 }); 1101 } 1102 }, 1103 1104 1105 enable_icarousel : function( content ){ 1106 var elements = content.find('.th-icarousel'); 1107 if(elements && elements.length){ 1108 $.each(elements, function(i, e){ 1109 1110 var element = $(e), 1111 carouselSettings = { 1112 easing: 'easeInOutQuint', 1113 pauseOnHover: true, 1114 timerPadding: 0, 1115 timerStroke: 4, 1116 timerBarStroke: 0, 1117 animationSpeed: 700, 1118 nextLabel: "", 1119 previousLabel: "", 1120 autoPlay: element.is("[data-autoplay]") ? element.data('autoplay') : true, 1121 slides: element.is("[data-slides]") ? element.data('slides') : 7, 1122 pauseTime: element.is("[data-timeout]") ? element.data('timeout') : 5000, 1123 perspective: element.is("[data-perspective]") ? element.data('perspective') : 75, 1124 slidesSpace: element.is("[data-slidespaces]") ? element.data('slidespaces') : 300, 1125 direction: element.is("[data-direction]") ? element.data('direction') : "ltr", 1126 timer: element.is("[data-timer]") ? element.data('timer') : "Bar", 1127 timerOpacity: element.is("[data-timeropc]") ? element.data('timeropc') : 0.4, 1128 timerDiameter: element.is("[data-timerdim]") ? element.data('timerdim') : 220, 1129 keyboardNav: element.is("[data-keyboard]") ? element.data('keyboard') : true, 1130 mouseWheel: element.is("[data-mousewheel]") ? element.data('mousewheel') : true, 1131 timerColor: element.is("[data-timercolor]") ? element.data('timercolor') : "#FFF", 1132 timerPosition: element.is("[data-timerpos]") ? element.data('timerpos') : "bottom-center", 1133 timerX: element.is("[data-timeroffx]") ? element.data('timeroffx') : 0, 1134 timerY: element.is("[data-timeroffy]") ? element.data('timeroffy') : -20 1135 }; 1136 1137 // Start the carousel already :) 1138 if(typeof($.fn.iCarousel) != 'undefined') { 1139 element.imagesLoaded( function() { 1140 element.iCarousel(carouselSettings); 1141 }); 1142 } 1143 }); 1144 } 1145 }, 1146 1147 enable_ios_slider : function( content ){ 1148 1149 function slideChange(args) { 1150 var theSlider = $(args.sliderObject), 1151 activeSlide = args.currentSlideNumber - 1, 1152 sliderContainer = theSlider.closest('.iosslider-slideshow'); 1153 // console.log(args); 1154 // add active to bullets 1155 sliderContainer.find('.kl-ios-selectors-block .iosslider__bull-item').removeClass('selected'); 1156 sliderContainer.find('.kl-ios-selectors-block .iosslider__bull-item:eq(' + activeSlide + ')').addClass('selected'); 1157 // add active class 1158 theSlider.find('.iosslider__item').removeClass('kl-iosslider-active'); 1159 theSlider.find('.iosslider__item:eq(' + activeSlide + ')').addClass('kl-iosslider-active'); 1160 } 1161 1162 function sliderLoaded(args, otherSettings) { 1163 var theSlider = $(args.sliderObject); 1164 if (otherSettings.hideControls) theSlider.addClass('hideControls'); 1165 if (otherSettings.hideCaptions) theSlider.addClass('hideCaptions'); 1166 1167 if(typeof( args.currentSlideNumber ) != 'undefined') { 1168 slideChange(args); 1169 } 1170 theSlider.closest('.iosslider-slideshow').addClass('kl-slider-loaded'); 1171 } 1172 1173 var elements = content.find('.iosSlider'); 1174 1175 if(elements && elements.length){ 1176 $.each( elements , function(i, e){ 1177 var self = $(e), 1178 selfContainer = self.closest('.kl-slideshow'); 1179 1180 if(typeof($.fn.iosSlider) != 'undefined') { 1181 self.iosSlider({ 1182 snapToChildren: true, 1183 desktopClickDrag: self.data('clickdrag') == '1' ? true : false, 1184 keyboardControls: true, 1185 autoSlide: self.data('autoplay') == '1' ? true : false, 1186 autoSlideTimer: self.data('trans'), 1187 navNextSelector: selfContainer.find('.kl-iosslider-next'), 1188 navPrevSelector: selfContainer.find('.kl-iosslider-prev'), 1189 navSlideSelector: selfContainer.find('.kl-ios-selectors-block .item'), 1190 scrollbar: true, 1191 scrollbarContainer: selfContainer.find('.scrollbarContainer'), 1192 scrollbarMargin: '0', 1193 scrollbarBorderRadius: '4px', 1194 onSliderLoaded: function(args){ 1195 var otherSettings = { 1196 hideControls : true, 1197 hideCaptions : false 1198 }; 1199 sliderLoaded(args, otherSettings); 1200 }, 1201 onSlideChange: slideChange, 1202 infiniteSlider: self.data('infinite') 1203 }); 1204 } 1205 1206 $( window ).on( 'debouncedresize' , function(){ 1207 if(typeof($.fn.iosSlider) != 'undefined') { 1208 self.iosSlider('update'); 1209 } 1210 }); 1211 1212 }); 1213 } 1214 }, 1215 1216 enable_portfolio_slider : function( content ){ 1217 1218 var elements = content.find('.psl-carousel__container'); 1219 1220 if(elements && elements.length){ 1221 $.each(elements, function(i, e){ 1222 var self = $(e); 1223 var highlight = function(data) { 1224 var item = self.triggerHandler('currentVisible'); 1225 self.children('.psl-carousel__item').removeClass('psl--active-item'); 1226 item.addClass('psl--active-item'); 1227 }; 1228 var unhighlight = function(data) { 1229 self.children('.psl-carousel__item').removeClass('psl--active-item'); 1230 }; 1231 if(typeof($.fn.carouFredSel) != 'undefined') { 1232 self.carouFredSel({ 1233 responsive: true, 1234 width: 1140, 1235 scroll : { 1236 fx: 'fade', 1237 duration : 1000, 1238 timeoutDuration : 3000, 1239 onBefore : unhighlight, 1240 onAfter : highlight 1241 }, 1242 auto : false, 1243 next : { 1244 button: self.closest('.psl-carousel__wrapper').find('.psl__next'), 1245 key: 'right' 1246 }, 1247 prev : { 1248 button: self.closest('.psl-carousel__wrapper').find('.psl__prev'), 1249 key: 'left' 1250 }, 1251 swipe: { 1252 onTouch: true, 1253 onMouse: true 1254 }, 1255 onCreate : highlight 1256 }); 1257 } 1258 }); 1259 } 1260 }, 1261 1262 enable_testimonials_partners : function( content ){ 1263 1264 var elements = content.find('.ts-pt-partners__carousel'); 1265 1266 if(elements && elements.length){ 1267 $.each(elements, function(i, e){ 1268 var self = $(e); 1269 var highlight = function(data) { 1270 var item = self.triggerHandler('currentVisible'); 1271 self.children('.ts-pt-partners__carousel-item').removeClass('ts-pt--active-item'); 1272 item.addClass('ts-pt--active-item'); 1273 }; 1274 var unhighlight = function(data) { 1275 self.children('.ts-pt-partners__carousel-item').removeClass('ts-pt--active-item'); 1276 }; 1277 if(typeof($.fn.carouFredSel) != 'undefined') { 1278 self.carouFredSel({ 1279 responsive: true, 1280 items: { 1281 visible: { 1282 min: 1, 1283 max: 5 1284 } 1285 }, 1286 scroll : { 1287 fx: 'fade', 1288 duration : 1000, 1289 timeoutDuration : 3000, 1290 onBefore : unhighlight, 1291 onAfter : highlight 1292 }, 1293 auto : true, 1294 onCreate : highlight 1295 }); 1296 } 1297 }); 1298 } 1299 }, 1300 1301 enable_appeared : function( content ){ 1302 1303 // Iconboxes with appearance effect
1304 var el = content.find('.el--appear'); 1305 if(el && el.length){ 1306 $.each(el, function(i, e){ 1307 var self = $(e), 1308 loaded = false; 1309 // Appear faded 1310 if(!loaded) { 1311 if(self.is( ':in-viewport' )){ 1312 self.addClass('el--appeared'); 1313 loaded = true; 1314 } 1315 $(window).scroll(function() { 1316 if(self.is( ':in-viewport' )){ 1317 self.addClass('el--appeared'); 1318 loaded = true; 1319 } 1320 }); 1321 } 1322 }); 1323 } 1324 }, 1325 1326 enable_iconbox : function( content ){ 1327 1328 // Iconboxes with appearance effect 1329 var el_stage = content.find('.kl-iconbox[data-stageid]'); 1330 if(el_stage && el_stage.length){ 1331 $.each(el_stage, function(i, e){ 1332 var self = $(e), 1333 stageid = self.attr('data-stageid'), 1334 title = self.attr('data-pointtitle') ? 'data-title="'+self.attr('data-pointtitle')+'"' : '', 1335 px = self.attr('data-pointx'), 1336 py = self.attr('data-pointy'), 1337 theStage = $('.'+stageid); 1338 1339 if(stageid && px && py){ 1340 var span = $('<span style="top:'+py+'px; left: '+px+'px;" class="stage-ibx__point" '+title+'></span>'); 1341 $('.'+stageid).find('.stage-ibx__stage').append( span ); 1342 setTimeout(function(){ 1343 span.css('opacity',1); 1344 }, 300*i); 1345 self.on('mouseover', span ,function(){ 1346 span.addClass('is-hover'); 1347 }); 1348 self.on('mouseout', span ,function(){ 1349 span.removeClass('is-hover'); 1350 }); 1351 } 1352 }); 1353 } 1354 }, 1355 1356 enable_searchbox : function( content ){ 1357 1358 // Iconboxes with appearance effect 1359 var el = content.find('.elm-searchbox--eff-typing'); 1360 if(el && el.length){ 1361 $.each(el, function(i, e){ 1362 1363 $(e).find('.elm-searchbox__input') 1364 .on('focus', function(ev){ 1365 $(this).addClass('is-focused'); 1366 }) 1367 .on('keyup', function(ev){ 1368 if( $(this).val() != '' ){ 1369 $(this).addClass('is-focused'); 1370 } 1371 }) 1372 .on('blur', function(ev){ 1373 if( $(this).val() == '' ){ 1374 $(this).removeClass('is-focused'); 1375 } 1376 }); 1377 1378 }); 1379 } 1380 1381 }, 1382 1383 enable_laptop_slider : function( content ){ 1384 1385 function slideChange(args) { 1386 var iosSlider = args.sliderContainerObject, 1387 detailsBlock = iosSlider.attr('data-details'); 1388 1389 // Details blocks 1390 if(typeof detailsBlock != 'undefined'){ 1391 $(detailsBlock).find('.ls_slide_item-details').removeClass('selected'); 1392 $(detailsBlock).find('.ls_slide_item-details:eq(' + (args.currentSlideNumber - 1) + ')').addClass('selected'); 1393 } 1394 // bullets 1395 $(iosSlider).closest('.ls__laptop-mask').find('.ls__nav .ls__nav-item').removeClass('selected'); 1396 $(iosSlider).closest('.ls__laptop-mask').find('.ls__nav .ls__nav-item:eq(' + (args.currentSlideNumber - 1) + ')').addClass('selected'); 1397 1398 // Item active class 1399 $(iosSlider).find('.ls__slider-item').removeClass('item--active'); 1400 $(iosSlider).find('.ls__slider-item:eq(' + (args.currentSlideNumber - 1) + ')').addClass('item--active'); 1401 } 1402 1403 function sliderLoaded(args) { 1404 slideChange(args); 1405 args.sliderContainerObject.closest('.kl-slideshow').addClass('kl-slider-loaded'); 1406 } 1407 1408 var elements = content.find('.zn_laptop_slider'); 1409 1410 if(elements && elements.length && elements.find('.ls__slider-item').length){ 1411 $.each( elements , function(i, e){ 1412 var self = $(e); 1413 if(typeof($.fn.iosSlider) != 'undefined') { 1414 self.iosSlider({ 1415 snapToChildren: true, 1416 desktopClickDrag: true, 1417 keyboardControls: true, 1418 autoSlideTimer: parseInt( self.attr('data-trans') ), 1419 navNextSelector: self.closest('.ls__laptop-mask').find('.ls__arrow-right'), 1420 navPrevSelector: self.closest('.ls__laptop-mask').find('.ls__arrow-left'), 1421 navSlideSelector: self.closest('.ls__laptop-mask').find('.ls__nav .ls__nav-item'), 1422 scrollbar: false, 1423 onSliderLoaded: sliderLoaded, 1424 onSlideChange: slideChange, 1425 infiniteSlider: true, 1426 autoSlide: self.attr('data-autoplay') 1427 }); 1428 } 1429 $( window ).on( 'debouncedresize' , function(){ 1430 if(typeof($.fn.iosSlider) != 'undefined') { 1431 self.iosSlider('update'); 1432 } 1433 }).trigger('debouncedresize'); 1434 }); 1435 } 1436 1437 // Prevent default for bullet navigation 1438 $( content ).find('.ls__nav-item').click(function(e){ return false; }); 1439 }, 1440 1441 enable_latest_posts_accordion : function( content ){ 1442 var elements = content.find('.css3accordion'); 1443 if(elements && elements.length > 0){ 1444 elements.each(function(i,el){ 1445 $(el).find('.inner-acc').css('width', $(el).width() /2 ); 1446 $(window).resize(function(event) { 1447 $(el).find('.inner-acc').css('width', $(el).width() /2 ); 1448 }); 1449 }); 1450 } 1451 }, 1452 1453 enable_portfolio_sortable : function( content ) 1454 { 1455 1456 var wpkznSelector = $(content).find("ul#thumbs"); 1457 if( wpkznSelector.length === 0) { return; } 1458 1459 var kl_ptf_sortable = $(wpkznSelector).closest('.kl-ptfsortable'), 1460 sortbyList = kl_ptf_sortable.find('#sortBy'), 1461 sortBy = sortbyList.is('[data-default]') ? sortbyList.attr('data-default') : 'date', 1462 sortDirList = kl_ptf_sortable.find('#sort-direction'),
1463 sortAscending = sortDirList.is('[data-default]') && sortDirList.attr('data-default') == 'asc' ? true : false, 1464 theFilter = $(content).find('#portfolio-nav li.current a').attr('data-filter'); /* DEFAULT FILTERING CATEGORY */ 1465 1466 wpkznSelector.imagesLoaded( function() { 1467 wpkznSelector.isotope({ 1468 itemSelector: ".item", 1469 animationEngine: "jquery", 1470 animationOptions: { 1471 duration: 250, 1472 easing: "easeOutExpo", 1473 queue: false 1474 }, 1475 layoutMode: 'masonry', 1476 filter: theFilter, 1477 sortBy: sortBy, 1478 sortAscending: sortAscending, 1479 getSortData: { 1480 name: '.name', 1481 date: '[data-date] parseInt' 1482 } 1483 }); 1484 // End isotope 1485 }); 1486 1487 //#1 Filtering 1488 var a_elements = $(content).find('#portfolio-nav li a'); 1489 if(a_elements && a_elements.length > 0) { 1490 $.each(a_elements, function (a, b) { 1491 $(b).on('click', function (w) { 1492 w.preventDefault(); 1493 $(content).find('#portfolio-nav li').removeClass('current'); 1494 $(b).parent().addClass('current'); 1495 wpkznSelector.isotope({filter: $(b).data('filter')}); 1496 wpkznSelector.isotope('updateSortData').isotope(); 1497 }); 1498 }); 1499 } 1500 1501 //#! Sorting (name | date) 1502 var b_elements = sortbyList.find('li a'); 1503 if(b_elements && b_elements.length > 0){ 1504 b_elements.removeClass('selected'); 1505 $.each(b_elements, function(index, element) { 1506 var t = $(element), 1507 csb = t.data('optionValue'); 1508 if(csb == sortBy){ 1509 t.addClass('selected'); 1510 } 1511 1512 1513 }); 1514 1515 b_elements.on('click', function(e){ 1516 e.preventDefault(); 1517 b_elements.removeClass('selected'); 1518 $(this).addClass('selected'); 1519 sortBy = $(this).data('optionValue'); 1520 wpkznSelector.isotope({sortBy: $(this).data('optionValue')}); 1521 wpkznSelector.isotope('updateSortData').isotope(); 1522 }); 1523 1524 } 1525 1526 //#! Sorting Direction (asc | desc) 1527 var c_elements = sortDirList.find('li a'); 1528 if(c_elements && c_elements.length > 0) { 1529 c_elements.removeClass('selected'); 1530 $.each(c_elements,function(index, element) { 1531 var t = $(element), 1532 csv = t.data('option-value'); 1533 1534 if(csv == sortAscending){ 1535 t.addClass('selected'); 1536 } 1537 1538 }); 1539 1540 c_elements.on('click', function(e){ 1541 e.preventDefault(); 1542 c_elements.removeClass('selected'); 1543 $(this).addClass('selected'); 1544 wpkznSelector.isotope({sortAscending: $(this).data('option-value'), sortBy: sortBy}); 1545 wpkznSelector.isotope('updateSortData').isotope(); 1546 }); 1547 1548 } 1549 1550 }, 1551 1552 enable_gridphotogallery : function( content ){ 1553 var gridPhotoGallery = content.find('.gridPhotoGallery:not(.stop-isotope)'); 1554 if(typeof($.fn.isotope) != 'undefined') { 1555 $.each(gridPhotoGallery, function(i, el) { 1556 var $el = $(el), 1557 itemWidth = Math.floor( $(el).width() / $el.attr('data-cols') ), 1558 doIsotope = $el.isotope({ 1559 itemSelector : '.gridPhotoGallery__item', 1560 masonry: { 1561 columnWidth: '.gridPhotoGallery__item--sizer', 1562 gutter:0 1563 } 1564 }); 1565 doIsotope.isotope('layout'); 1566 }); 1567 } 1568 }, 1569 1570 enable_nivo_slider : function( content ){ 1571 var elements = $('.nivoslider .nivoSlider'); 1572 if(elements && elements.length){ 1573 $.each(elements, function(i, e){ 1574 var slider = $(e), 1575 transition = slider.attr('data-transition'), 1576 autoslide = slider.attr('data-autoslide') != '1' ? true : false, 1577 pausetime = slider.attr('data-pausetime'); 1578 if(typeof($.fn.nivoSlider) != 'undefined') { 1579 slider.nivoSlider({ 1580 effect:transition, 1581 boxCols: 8, 1582 boxRows: 4, 1583 slices:15, 1584 animSpeed:500, 1585 pauseTime: pausetime, 1586 startSlide:0, 1587 directionNav:1, 1588 controlNav:1, 1589 controlNavThumbs:0, 1590 pauseOnHover:1, 1591 manualAdvance: autoslide, 1592 afterLoad: function(){ 1593 /* slideFirst() */ 1594 setTimeout(function(){ 1595 slider.find('.nivo-caption').animate({left:20, opacity:1}, 500, 'easeOutQuint'); 1596 }, 1000); 1597 }, 1598 beforeChange: function(){ 1599 /* slideOut() */ 1600 slider.find('.nivo-caption').animate({left:120, opacity:0}
1600, 500, 'easeOutQuint'); 1601 }, 1602 afterChange: function(){ 1603 /* slideIn() */ 1604 slider.find('.nivo-caption').animate({left:20, opacity:1}, 500, 'easeOutQuint'); 1605 } 1606 }); 1607 } 1608 }); 1609 } 1610 }, 1611 1612 enable_recent_works2 : function( content ){ 1613 var elements = content.find('.recent_works2'); 1614 if(elements && elements.length){ 1615 $.each(elements, function(i, e){ 1616 var self = $(e); 1617 if(typeof($.fn.carouFredSel) != 'undefined') { 1618 1619 var autoplay = self.attr('data-autoplay') ? parseInt(self.data('autoplay')) : 0, 1620 timeout = self.attr('data-timeout') ? parseInt(self.data('timeout')) : 5000; 1621 1622 var options = { 1623 responsive: true, 1624 scroll: 1, 1625 auto: false, 1626 items: { 1627 width: 350, 1628 visible: { 1629 min: 1, 1630 max: 4 1631 } 1632 }, 1633 prev : { 1634 button : function(){return self.closest('.recentwork_carousel').find('.prev');}, 1635 key : "left" 1636 }, 1637 next : { 1638 button : function(){return self.closest('.recentwork_carousel').find('.next');}, 1639 key : "right" 1640 } 1641 }; 1642 if(autoplay > 0 && timeout >= 100){ 1643 options['auto'] = true; 1644 options['timeoutDuration'] = timeout; 1645 } 1646 1647 self.carouFredSel(options); 1648 } 1649 }); 1650 } 1651 }, 1652 1653 enable_recent_works3 : function( content ){ 1654 var elements = content.find('.recent_works3'); 1655 if(elements && elements.length){ 1656 $.each(elements, function(i, e){ 1657 var self = $(e); 1658 if(typeof($.fn.carouFredSel) != 'undefined') { 1659 var autoplay = self.attr('data-autoplay') ? parseInt(self.data('autoplay')) : 0, 1660 timeout = self.attr('data-timeout') ? parseInt(self.data('timeout')) : 5000; 1661 1662 var options = { 1663 responsive: true, 1664 scroll: 1, 1665 auto: false, 1666 items: { 1667 width: 350, 1668 visible: { 1669 min: 1, 1670 max: 5 1671 } 1672 }, 1673 prev : { 1674 button : function(){return self.closest('.recentwork_carousel').find('.prev');}, 1675 key : "left" 1676 }, 1677 next : { 1678 button : function(){return self.closest('.recentwork_carousel').find('.next');}, 1679 key : "right" 1680 } 1681 }; 1682 if(autoplay > 0 && timeout >= 100){ 1683 options['auto'] = true; 1684 options['timeoutDuration'] = timeout; 1685 } 1686 1687 self.carouFredSel(options); 1688 } 1689 }); 1690 } 1691 }, 1692 1693 enableLatestPostsCarousel : function( content ){ 1694 var elements = content.find('.lp_carousel'); 1695 if(elements && elements.length && (typeof($.fn.carouFredSel) != 'undefined')){ 1696 $.each(elements, function(i, e){ 1697 var self = $(e); 1698 self.imagesLoaded( function() { 1699 self.carouFredSel({ 1700 responsive: true, 1701 scroll: 1, 1702 auto: false, 1703 items: { 1704 width: 350, 1705 visible: { 1706 min: 1, 1707 max: 3 1708 } 1709 }, 1710 prev : { 1711 button : function(){return self.closest('.latest-posts-carousel').find('.prev');}, 1712 key : "left" 1713 }, 1714 next : { 1715 button : function(){return self.closest('.latest-posts-carousel').find('.next');}, 1716 key : "right" 1717 } 1718 }); 1719 }); 1720 1721 }); 1722 } 1723 }, 1724 1725 enable_screenshoot_box : function( content ){
1726 var elements = content.find('.zn_screenshot-carousel'); 1727 if(elements && elements.length){ 1728 $.each(elements, function(i, e){ 1729 var self = $(e), 1730 _pDataAttr = self.attr('data-carousel-pagination'); 1731 1732 var options = { 1733 responsive: true, 1734 scroll: { fx: "crossfade", duration: "1500" }, 1735 auto: true, 1736 responsive: true, 1737 prev : { 1738 button : function(){return self.closest('.thescreenshot').find('.prev');}, 1739 key : "left" 1740 }, 1741 next : { 1742 button : function(){return self.closest('.thescreenshot').find('.next');}, 1743 key : "right" 1744 } 1745 }; 1746 1747 if(typeof(_pDataAttr) != 'undefined'){ 1748 options['pagination'] = _pDataAttr; 1749 } 1750 if(typeof($.fn.carouFredSel) != 'undefined') { 1751 self.imagesLoaded( function() { 1752 self.carouFredSel(options); 1753 }); 1754 } 1755 }); 1756 } 1757 }, 1758 1759 enable_wow_slider : function( content ){ 1760 var elements = content.find('.th-wowslider'); 1761 if(elements && elements.length){ 1762 $.each(elements, function(i, e){ 1763 var self = $(e); 1764 if(typeof($.fn.wowSlider) != 'undefined') { 1765 self.wowSlider({ 1766 effect: self.attr('data-transition'), 1767 duration:900, 1768 delay: self.is('[data-timeout]') ? self.attr('data-timeout') : 3000, 1769 width:1170, 1770 height:470, 1771 cols:6, 1772 autoPlay: self.attr('data-autoplay'), 1773 stopOnHover:true, 1774 loop:true, 1775 bullets:true, 1776 caption:true, 1777 controls:true, 1778 captionEffect:"slide", 1779 logo:"image/loading_light.gif", 1780 images:0, 1781 onStep: function(){ 1782 self.addClass('transitioning'); 1783 setTimeout(function(){ 1784 self.removeClass('transitioning'); 1785 }, 1400); 1786 1787 } 1788 }); 1789 } 1790 }); 1791 } 1792 }, 1793 1794 enable_mailchimp_subscribe : function( content ){ 1795 var element = content.find('.nl-submit'); 1796 if(element && element.length){ 1797 element.each(function(index, el) { 1798 $(el).on('click', function(e) { 1799 e.preventDefault(); 1800 var self = $(this), 1801 ajax_url = self.parent().attr('data-url'), 1802 email_field = self.parent().find('.nl-email').val(), 1803 result_placeholder = self.parent().next('.zn_mailchimp_result'); 1804 1805 if(email_field == ''){ 1806 self.parent().addClass('has-error'); 1807 return; 1808 } 1809 1810 $.ajax({ 1811 url: ajax_url, 1812 type: 'POST', 1813 data: { 1814 zn_mc_email: email_field, 1815 zn_mailchimp_list: self.parent().find('.nl-lid').val(), 1816 zn_ajax: '' // Change here with something different 1817 }, 1818 success: function(data){ 1819 result_placeholder.html(data); 1820 }, 1821 error: function() { 1822 result_placeholder.html('ERROR.').css('color', 'red'); 1823 } 1824 }); 1825 }); 1826 }); 1827 } 1828 }, 1829 1830 enable_sc_showroomcarousel : function( content ){ 1831 var elements = content.find(".sc__showroom-carousel"); 1832 if(elements && elements.length){ 1833 $.each(elements, function(i, e){ 1834 var $this = $(e), 1835 $speed = $this.attr("data-speed"), 1836 $pagination = $('<div class="shcar__pagination"></div>'); 1837 1838 if( $this.attr("data-pag") && $this.attr("data-pag") == "1" ) 1839 $this.parent().prepend($pagination); 1840 if(typeof($.fn.carouFredSel) != 'undefined') { 1841 $this.carouFredSel({ 1842 responsive:true, 1843 height: 220, 1844 scroll: { pauseOnHover: true }, 1845 auto: { timeoutDuration: parseInt($speed) }, 1846 items: { 1847 width: 280, 1848 visible: { min: 1, max: 3 } 1849 }, 1850 pagination: { 1851 container: $this.parent().find('.shcar__pagination'), 1852 anchorBuilder: function(nr, item) { 1853 return '<a href="#'+nr+'"></a>'; 1854 } 1855 }, 1856 swipe: { 1857 onTouch: true, 1858 onMouse: true 1859 } 1860 }); 1861 } 1862 }); 1863 } 1864 }, 1865 1866 enable_testimonial_fader : function( content ){ 1867 var elements = content.find(".testimonials_fader_trigger"); 1868 if(elements && elements.length){ 1869 $.each(elements, function(i, e){ 1870 var self = $(e); 1871 if(typeof($.fn.carouFredSel) != 'undefined') { 1872 self.carouFredSel({ 1873 responsive:true, 1874 auto: self.is('[data-autoplay]') && self.attr('data-autoplay') == '1' ? true : false, 1875 scroll: { 1876 timeoutDuration : self.is('[data-speed]') ? parseInt(self.attr('data-speed')) : '2500' 1877 }, 1878 scroll: { 1879 fx: "fade", 1880 duration: 1500 1881 }, 1882 prev : { 1883 button : function(){return self.closest('.elm-testimonial-fader').find('.prev');}, 1884 key : "left" 1885 }, 1886 next : { 1887 button : function(){return self.closest('.elm-testimonial-fader').find('.next');},
1888 key : "right" 1889 } 1890 }); 1891 } 1892 }); 1893 } 1894 }, 1895 1896 enable_twitter_fader : function( content ){ 1897 var elements = content.find(".twitterFeed"); 1898 if(elements && elements.length && (typeof($.fn.carouFredSel) != 'undefined')){ 1899 $.each(elements, function(i, e){ 1900 var speed = 5000; 1901 var self = $(e); 1902 if(typeof(self.data('entries')) != 'undefined') { 1903 $(e).carouFredSel({ 1904 responsive:true, 1905 auto: {timeoutDuration: speed}, 1906 scroll: { 1907 fx: "fade", 1908 duration: 1500 1909 }, 1910 items: { 1911 visible: { 1912 min: 1, 1913 max: self.data('entries') 1914 } 1915 } 1916 }); 1917 } 1918 }); 1919 } 1920 }, 1921 1922 enable_testimonial_slider : function( content ){ 1923 var elements = content.find('.zn_testimonials_carousel'); 1924 if(elements && elements.length){ 1925 $.each(elements, function(i, e){ 1926 var self = $(e); 1927 if(typeof($.fn.carouFredSel) != 'undefined') { 1928 self.carouFredSel({ 1929 responsive: true, 1930 items: { width: 300 }, 1931 auto: self.is('[data-autoplay]') && self.attr('data-autoplay') == '1' ? true : false, 1932 scroll: { 1933 timeoutDuration : self.is('[data-speed]') ? parseInt(self.attr('data-speed')) : '2500' 1934 }, 1935 prev : { 1936 button : function(){return self.closest('.testimonials-carousel').find('.prev');}, 1937 key : "left" 1938 }, 1939 next : { 1940 button : function(){return self.closest('.testimonials-carousel').find('.next');}, 1941 key : "right" 1942 } 1943 }); 1944 } 1945 }); 1946 } 1947 }, 1948 1949 enable_shop_limited_offers : function( content ){ 1950 var elements = content.find('.zn_limited_offers'); 1951 if(elements && elements.length){ 1952 $.each(elements, function(i, e){ 1953 var self = $(e); 1954 // var speed = $(e).data("speed"); 1955 if(typeof($.fn.carouFredSel) != 'undefined') { 1956 1957 var autoplay = self.attr('data-autoplay') == '1' ? true : false;; 1958 1959 self.carouFredSel({ 1960 responsive: true, 1961 width: '92%', 1962 scroll: { 1963 items : 1, 1964 easing : "easeInOutExpo", 1965 duration : 1000, 1966 pauseOnHover : true, 1967 timeoutDuration: self.is("[data-timeout]") ? parseFloat( self.data('timeout') ) : 6000 1968 }, 1969 auto: autoplay, 1970 items: {width:190, visible: { min: 2, max: 4 } }, 1971 prev : { 1972 button : function(){return self.closest('.limited-offers-carousel').find('.prev');}, 1973 key : "left" 1974 }, 1975 next : { 1976 button : function(){return self.closest('.limited-offers-carousel').find('.next');}, 1977 key : "right" 1978 } 1979 }); 1980 } 1981 }); 1982 } 1983 }, 1984 1985 enable_static_weather : function( content ){ 1986 1987 var elements = content.find('.sc__weather'); 1988 1989 if(elements && elements.length){ 1990 $.each(elements, function(i, e){ 1991 var self = $(e), 1992 loc = self.attr('data-location') ? self.attr('data-location') : ''; 1993 1994 if( typeof($.simpleWeather) != 'undefined') { 1995 1996 $.simpleWeather({ 1997 woeid: self.attr('data-woeid'), 1998 location: loc, 1999 unit: self.attr('data-unit'), 2000 success: function(weather) { 2001 2002 html = '<ul class="scw_list clearfix">'; 2003 2004 for(var i=0;i<weather.forecast.length;i++) { 2005 html += '<li><i class="wt-icon wt-icon-'+weather.code+'"></i>'; 2006 html += '<div class="scw__degs">'; 2007 html += '<span class="scw__high">'+weather.forecast[i].high+'°<span class="uppercase">'+weather.units.temp+'</span></span>'; 2008 html += '<span class="scw__low">'+weather.forecast[i].low+'</span>'; 2009 html += '</div>'; 2010 html += '<span class="scw__day">' + weather.forecast[i].day+'</span>'; 2011 html += '<span class="scw__alt">
2011' + weather.forecast[i].alt.high+'°<span class="uppercase">'+ weather.alt.unit +'</span></span>'; 2012 html += '</li>'; 2013 } 2014 html += '</ul>'; 2015 2016 jQuery(self).html(html); 2017 }, 2018 error: function(error) { 2019 jQuery(self).html('<p>'+error+'</p>'); 2020 console.warn('Some problems: '+ error); 2021 } 2022 }); 2023 } 2024 }); 2025 } 2026 }, 2027 2028 enable_diagram: function(content){ 2029 2030 var diagram_el = content.find('.kl-skills-diagram'); 2031 2032 if(diagram_el && diagram_el.length){ 2033 diagram_el.each(function(index, el) { 2034 if(typeof diagramElement != 'undefined'){ 2035 diagramElement.init( el ); 2036 } 2037 }); 2038 } 2039 2040 }, 2041 2042 enable_services: function(content){ 2043 2044 var elements = content.find('.services_box--boxed'); 2045 2046 if(elements && elements.length){ 2047 elements.each(function(index, el) { 2048 // see how tall the box is and add an extra 30px 2049 $(el).find('.services_box__list').css('padding-top', $(el).height() + 30 ); 2050 $(el).hover( 2051 function() { 2052 $(el).css("z-index", '3' ); 2053 }, function() { 2054 $( this ).removeAttr( 'style' ); 2055 } 2056 ); 2057 2058 }); 2059 } 2060 2061 $(window).on('debouncedresize', function(){ 2062 if(elements && elements.length){ 2063 elements.each(function(index, el) { 2064 // see how tall the box is and add an extra 30px 2065 $(el).find('.services_box__list').css('padding-top', $(el).height() + 30 ); 2066 }); 2067 } 2068 }).trigger('debouncedresize'); 2069 2070 }, 2071 2072 enable_shoplatest_presentation: function(content){ 2073 2074 var lists = content.find('.shop-latest-carousel.spp-carousel--enabled > ul'); 2075 if(lists && lists.length > 0) { 2076 lists.each(function (index, element) { 2077 if(typeof($.fn.carouFredSel) != 'undefined') { 2078 $(element).imagesLoaded( function() { 2079 $(element).carouFredSel({ 2080 responsive: true, 2081 scroll: 1, 2082 auto: $(element).is('[data-autoplay]') && $(element).attr('data-autoplay') == 'yes' ? true : false, 2083 scroll: { 2084 timeoutDuration : $(element).is('[data-timeout]') ? parseInt($(element).attr('data-timeout')) : '5000' 2085 }, 2086 // height: 475, 2087 items: {width: 300, visible: {min: 1, max: 4}}, 2088 prev: {button: $(element).closest('.shop-latest-carousel').find('a.prev'), key: 'left'}, 2089 next: {button: $(element).closest('.shop-latest-carousel').find('a.next'), key: 'right'} 2090 }); 2091 }); 2092 } 2093 }); 2094 } 2095 }, 2096 2097 enable_scrollspy: function(content){ 2098 2099 var url = location.href.replace(/#.*/,''); 2100 $(window).scroll(function() { 2101 var fromTop = $(this).scrollTop(), 2102 lastId = false, 2103 the_offset = -3, 2104 topMenu = $('#main-menu, .chaser'), 2105 menuItems = topMenu.find("a"), 2106 2107 scrollItems = menuItems.map(function () { 2108 2109 var href = $(this).is('[href]') ? $(this).attr('href').replace(url,'') : ''; 2110 var item = $($(this.hash)); 2111 if (item.length) { 2112 return item; 2113 } 2114 }); 2115 2116 // CALCULATE EXTRA PADDING IN CASE WE HAVE WPADMINBAR AND MENU STYLE 1 2117 if( $('#wpadminbar').length > 0 ){ 2118 the_offset -= $('#wpadminbar').outerHeight(); 2119 } 2120 if( $('.chaser').length > 0 ){ 2121 the_offset -= $('.chaser').outerHeight(); 2122 } 2123 if( $('#header.header--sticky').length > 0 ){ 2124 the_offset -= $('#header').outerHeight(); 2125 } 2126 2127 // Get id of current scroll item 2128 var elements = []; 2129 var last_offset = 0; 2130 var cur = scrollItems.map(function (i, val){ 2131 // If the current offset < current scroll 2132 var current_offset = $(this).offset().top + the_offset; 2133 if ( current_offset <= fromTop ) { 2134 elements[i] = this; 2135 2136 } 2137 }); 2138 2139 // Get the id of the current element 2140 cur = elements[elements.length - 1]; 2141 var id = cur && cur.length ? cur[0].id : "zn_invalid_id"; 2142 2143 if (lastId !== id) { 2144 lastId = id; 2145 2146 // Check if the menu has such an item 2147 if( topMenu.find("a[href*=#" + id + "]").length > 0 && id != 'zn_invalid_id' ) { 2148 2149 topMenu.find("li").removeClass("current_page_item current-menu-item active"); 2150 $("a[href*=#" + id + "]").parent().addClass("current_page_item current-menu-item active"); 2151 } 2152 2153 } 2154 }).scroll(); 2155 2156 }, 2157 2158 enable_tooltips: function(content){ 2159 // activate tooltips 2160 var tooltips = content.find('[data-toggle="tooltip"], [data-rel="tooltip"]'); 2161 if(tooltips && tooltips.length > 0) { 2162 tooltips.tooltip(); 2163 } 2164 }, 2165 2166 enable_customMenuDropdown: function(content){ 2167 // 2168 var ddmenu = content.find('.elm-custommenu--dd'); 2169 if(ddmenu.length){ 2170 content.find('.elm-custommenu-pick').on('click', function(event) { 2171 ddmenu.toggleClass('is-opened'); 2172 }); 2173 } 2174 } 2175 2176 }; 2177 2178 $(document).ready(function () { 2179 // Call this on document ready 2180 $.themejs = new $.ZnThemeJs(); 2181 }); 2182 2183 2184 // Keep the last tab active 2185 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 2186 // save the latest tab; use cookies if you like 'em better: 2187 localStorage.setItem('znkl_lastTab', $(this).attr('href')); 2188 }); 2189 2190 // go to the latest tab, if it exists: 2191 var lastTab = localStorage.getItem('znkl_lastTab'); 2192 if (lastTab) { 2193 $('[href="' + lastTab + '"]').tab('show').addClass('active'); 2194 } 2195 2196 2197 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2198 ////// WINDOW LOAD ////// 2199 $(window).load(function () { 2200 // REMOVE PRELOADER 2201 2202 var preloader = $('#page-loading'); 2203 if ( preloader.length > 0 ) { 2204 preloader.fadeOut( "fast", function() { 2205 preloader.remove(); 2206 }); 2207 } 2208 2209 }); 2210 ////// END WINDOW LOAD 2211 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2212 2213/*-------------------------------------------------------------------------------------------------- 2214 Sparkles 2215 --------------------------------------------------------------------------------------------------*/ 2216 var Spark = function(sparkles_container){ 2217 this.sparkles_container = $(sparkles_container); 2218 this.s = ["shiny-spark1", "shiny-spark2", "shiny-spark3", "shiny-spark4", "shiny-spark5", "shiny-spark6"]; 2219 this.i = this.s[this.random(this.s.length)]; 2220 this.n = document.createElement("span"); 2221 this.newSpeed().newPoint().display().newPoint().fly(); 2222 }; 2223 Spark.prototype.display = function () 2224 { 2225 $(this.n).attr("class", this.i).css("z-index", this.random(3)).css("top", this.pointY).css("left", this.pointX); 2226 this.sparkles_container.append(this.n); 2227 return this 2228 }; 2229 Spark.prototype.fly = function () 2230 { 2231 var a = this; 2232 $(this.n).animate({top: this.pointY, left: this.pointX}, this.speed, "linear", function () 2233 { 2234 a.newSpeed().newPoint().fly(); 2235 }) 2236 }; 2237 Spark.prototype.newSpeed = function () 2238 { 2239 this.speed = (this.random(10) + 5) * 1100; 2240 return this 2241 }; 2242 Spark.prototype.newPoint = function () 2243 { 2244 var parentPos = this.sparkles_container, 2245 parentSlideshow = parentPos.closest('.kl-slideshow'), 2246 parentPh = parentPos.closest('.page-subheader'); 2247 if(parentSlideshow.length > 0) { 2248 parentPos = parentSlideshow; 2249 } else if(parentPh.length > 0) { 2250 parentPos = parentPh; 2251 } 2252 this.pointX = this.random( parentPos.width() ); 2253 this.pointY = this.random( parentPos.height() ); 2254 return this 2255 }; 2256 Spark.prototype.random = function (a) 2257 { 2258 return Math.ceil(Math.random() * a) - 1 2259 }; 2260 2261})(jQuery); 2262 2263 2264 2265 var onloadCallback = function() { 2266 jQuery('.zn-recaptcha').each(function(){ 2267 grecaptcha.render( jQuery(this).attr('id'), { 2268 'sitekey' : jQuery(this).data('sitekey'), 2269 'theme' : jQuery(this).data('colorscheme') 2270 }); 2271 }); 2272 }; 2273 2274(function ($) 2275{ 2276 "use strict"; 2277 2278 2279 2280 $(function($) 2281 { 2282 2283 2284 // prevent clicking on cart button 2285 // for touch screens
2286 if (Modernizr.touch) { 2287 $('a[href="#"]').on('click', function(e){ 2288 e.preventDefault(); 2289 }); 2290 } 2291 2292 $('body').bind('added_to_cart',function (evt,ret) { 2293 var mycart = $('#mycartbtn'); // ID must be provided 2294 if(mycart && mycart.length > 0) { 2295 var mycartTop = mycart.offset().top, 2296 mycartLeft = mycart.offset().left, 2297 butonCart = $('.to_cart button.addtocart '), 2298 buttonCartHome = $('.add_to_cart_button '), 2299 placeholderdiv = $('<div class="popupaddcart">'+zn_do_login.add_to_cart_text+'</div>'); 2300 2301 $('body').append(placeholderdiv); 2302 $(placeholderdiv).hide(); 2303 $(placeholderdiv).fadeIn('slow', 'easeInOutExpo',function() { 2304 //console.log( $(this) ); 2305 var zn_pos_top = $(this).offset().top, 2306 zn_pos_left = $(this).offset().left; 2307 $(this) 2308 .css({margin:0,left:zn_pos_left,top:zn_pos_top,position:'absolute'}) 2309 .delay(800) 2310 .animate( 2311 { 2312 top: mycartTop, 2313 left:mycartLeft, 2314 opacity:1 2315 }, 2000, 'easeInOutExpo', function() { 2316 $(this).remove(); 2317 }); 2318 }); 2319 } 2320 }); 2321 2322 // Window Scroll event 2323 $(window).scroll(function() { 2324 2325 // Close Sliding panel when scrolling the page (in sticky header mode) 2326 var sliding_panel = $('.kl-sticky-header #sliding_panel'); 2327 if(sliding_panel.hasClass('is-opened')){ 2328 sliding_panel.removeClass('is-opened'); 2329 $('#open_sliding_panel').removeClass('is-toggled'); 2330 } 2331 }); 2332 2333 // LOGIN FORM 2334 var zn_form_login = $('.zn_form_login'); 2335 zn_form_login.on('submit', function(event){ 2336 event.preventDefault(); 2337 2338 var form = $(this), 2339 warning = false, 2340 button = $('.zn_sub_button', this), 2341 values = form.serialize(); 2342 2343 button.addClass('zn_blocked'); 2344 2345 $('input', form).each(function(i, el){ 2346 var $el = $(el); 2347 if ( !$el.val() ){ 2348 warning = true; 2349 $el.parent('.form-group').addClass('fg-input-invalid'); 2350 } else { 2351 $el.parent('.form-group').removeClass('fg-input-invalid'); 2352 } 2353 }); 2354 2355 if (warning) { 2356 button.removeClass('zn_blocked'); 2357 return false; 2358 } 2359 2360 // if (button.hasClass('zn_blocked')) { 2361 // return false; 2362 // } 2363 2364 // button.addClass('zn_blocked'); 2365 // 2366 $.post(zn_do_login.ajaxurl, values, function (resp) 2367 { 2368 var data = $(document.createElement('div')).html(resp); 2369 2370 if ( $('#login_error', data).length ) { 2371 var result_block = $('.zn_form_login-result', form); 2372 result_block.html(data); 2373 if( result_block.find('.kl-login-box').length ){ 2374 result_block.find('.kl-login-box').magnificPopup({type: 'inline', closeBtnInside:true, showCloseBtn: true, mainClass: 'mfp-fade mfp-bg-lighter'}); 2375 } 2376 button.removeClass('zn_blocked'); 2377 } 2378 else { 2379 if ($('.zn_login_redirect', form).length > 0) { 2380 $.magnificPopup.close(); 2381 window.location = $('.zn_login_redirect', form).val(); 2382 } 2383 } 2384 button.removeClass('zn_blocked'); 2385 }); 2386 }); 2387 2388 // LOST PASSWORD 2389 var zn_form_lost_pass = $('.zn_form_lost_pass'); 2390 zn_form_lost_pass.on('submit', function(){ 2391 event.preventDefault(); 2392 2393 var form = $(this), 2394 warning = false, 2395 button = $('.zn_sub_button', this), 2396 values = form.serialize() + '&ajax_login=true'; 2397 2398 button.addClass('zn_blocked'); 2399 2400 $('input', form).each(function(i, el){ 2401 var $el = $(el); 2402 if ( !$el.val() ){ 2403 warning = true; 2404 $el.parent('.form-group').addClass('fg-input-invalid'); 2405 } else { 2406 $el.parent('.form-group').removeClass('fg-input-invalid'); 2407 } 2408 }); 2409 2410 if (warning) { 2411 button.removeClass('zn_blocked'); 2412 return false; 2413 } 2414 2415 // if (button.hasClass('zn_blocked')) { 2416 // return; 2417 // } 2418 // button.addClass('zn_blocked'); 2419 2420 $.ajax({ 2421 url: form.attr('action'), data: values, type: 'POST', cache: false, success: function (resp) 2422 { 2423 var data = $(document.createElement('div')).html(resp); 2424 2425 if ($('#login_error', data).length) { 2426 // We have an error 2427 var error = $('#login_error', data); 2428 $('.zn_form_login-result', form).html(error); 2429 } 2430 else if ($('.message', data).length) { 2431 var message = $('.message', data); 2432 $('.zn_form_login-result', form).html(message); 2433 } 2434 else if( $('.woocommerce-message', data).length ){ 2435 var message = $('.woocommerce-message', data); 2436 $('.zn_form_login-result', form).html(message); 2437 // console.log('woocommerce message'); 2438 } 2439 else if( $('.woocommerce-error', data).length ){ 2440 var message = $('.woocommerce-error', data); 2441 $('.zn_form_login-result', form).html(message); 2442 // console.log('woocommerce message'); 2443 } 2444 else { 2445 jQuery.magnificPopup.close(); 2446 window.location = $('.zn_login_redirect', form).val(); 2447 } 2448 button.removeClass('zn_blocked'); 2449 }, error: function (jqXHR, textStatus, errorThrown){ 2450 $('.zn_form_login-result', form).html(errorThrown); 2451 } 2452 }); 2453 }); 2454 2455 // Made the shop image to change on hover over thumbnails 2456 if ( typeof ZnWooCommerce != 'undefined' ){ 2457 if ( ZnWooCommerce.show_thumb_on_hover ){ 2458 var znwoo_main_imgage = $( 'a.woocommerce-main-image' ).attr( 'href' ); 2459 2460 $('.single_product_main_image').hover(function(){ 2461 2462 $('.thumbnails',this).find('a').hover(function(el){ 2463 2464 var width = $('.woocommerce-main-image').width(); 2465 var height = $('.woocommerce-main-image').height(); 2466 2467 var photo_fullsize = $( this ).attr( 'href' ); 2468 $( '.woocommerce-main-image img' ).attr( 'src', photo_fullsize ).attr( 'srcset', photo_fullsize ); 2469 $( '.woocommerce-main-image' ).css({'min-width': width,'min-height': height}); 2470 }) ; 2471 2472 }, 2473 function(){ 2474 $( '.woocommerce-main-image img' ).attr( 'src', znwoo_main_imgage ).attr( 'srcset', znwoo_main_imgage ).removeAttr('style'); 2475 $( '.woocommerce-main-image' ).removeAttr('style'); 2476 }); 2477 2478 } 2479 } 2480 2481 2482 // --- search panel 2483 var searchBtn = $('#search .searchBtn'), 2484 searchPanel = searchBtn.next(), 2485 searchP = searchBtn.parent(); 2486 if( searchBtn && searchBtn.length > 0 ){ 2487 searchBtn.on('click', function(e){ 2488 e.preventDefault(); 2489 var self = $(this); 2490 var target = $('span:first-child', self); 2491 if (!self.hasClass('active')) { 2492 self.addClass('active'); 2493 target.toggleClass('glyphicon-remove'); 2494 searchPanel.addClass('panel-opened'); 2495 } 2496 else { 2497 self.removeClass('active'); 2498 target.toggleClass('glyphicon-remove'); 2499 searchPanel.removeClass('panel-opened'); 2500 } 2501 }); 2502 if(searchP.hasClass('headsearch--def')){ 2503 $(document).click(function(e){ 2504 var searchBtn = $('#search .searchBtn'); 2505 searchBtn.removeClass('active'); 2506 searchBtn.next().removeClass('panel-opened'); 2507 $('span:first-child', searchBtn).removeClass('glyphicon-remove').addClass('glyphicon-search'); 2508 }); 2509 } 2510 searchP.click(function (event){ 2511 event.stopPropagation(); 2512 }); 2513 } 2514 2515 // --- end search panel 2516 2517 /* scroll to top */
2518 var toTop = $("#totop"); 2519 if(toTop && toTop.length > 0){ 2520 toTop.on('click',function (e){ 2521 e.preventDefault(); 2522 $('body,html').animate({scrollTop: 0}, 800, 'easeOutExpo'); 2523 }); 2524 } 2525 // --- end scroll to top 2526 2527 /* Tonext button - Scrolls to next block (used for fullscreen slider) */ 2528 $(".js-tonext-btn").on('click',function (e) { 2529 e.preventDefault(); 2530 var endof = $(this).attr('data-endof') ? $(this).attr('data-endof') : false, 2531 dest = 0; 2532 2533 if ( endof ) 2534 dest = $(endof).height() + $(endof).offset().top; 2535 2536 //go to destination 2537 $('html,body').animate({scrollTop: dest}, 1000, 'easeOutExpo'); 2538 }); 2539 2540 /* Smooth scroll to id */ 2541 $("a[data-target='smoothscroll'][href*=#]:not([href=#]), .main-menu a[href*=#]:not([href=#])").on('click',function (e) { 2542 //e.preventDefault(); 2543 2544 var url = $(this).attr('href'), 2545 href = url.substring(url.indexOf('#')); 2546 2547 if( typeof href !== 'undefined' && href.indexOf("#") != -1 && $(href).length > 0 ) { 2548 2549 var offset = $(href).offset().top; 2550 2551 if( $('#wpadminbar').length > 0 ){ 2552 offset -= $('#wpadminbar').outerHeight(); 2553 } 2554 if( $('.chaser').length > 0 ){ 2555 offset -= $('.chaser').outerHeight(); 2556 } 2557 if( $('#header.header--sticky').length > 0 ){ 2558 offset -= $('.header--is-sticked #header').outerHeight(); 2559 } 2560 2561 //go to destination 2562 if( $(href).length ) 2563 $('html,body').stop().animate({scrollTop: offset }, 1000, 'easeOutExpo'); 2564 } else { 2565 console.log('Not a valid link'); 2566 } 2567 }); 2568 2569 2570 2571 2572 /** 2573 * Add a modifier class to an element, upon user defined scrolling target element or number 2574 * @forch Is the point where, upon scrolling, the class modifier is added. Default is "1". 2575 * @targetElementForClass Target element which will have the modifier class. Default is "body". 2576 * @classForVisibleState Modifier class name. Default is "is--visible". 2577 * usage: <tag class="js-scroll-event" data-forch="100" or data-forch="#some_id" data-target="#header" data-visibleclass="is--scrolling" data-hiddenclass="not--scrolling"></tag> 2578 */ 2579 $(".js-scroll-event").each(function(index, el) { 2580 2581 var $el = $(el), 2582 defaultForch = 1, 2583 visible = false, 2584 doc = $(document), 2585 targetElementForClass = $el.data().hasOwnProperty('target') ? $el.data("target") : 'body', 2586 classForVisibleState = $el.data().hasOwnProperty('visibleclass') ? $el.data("visibleclass") : 'is--visible', 2587 classForHiddenState = $el.data().hasOwnProperty('hiddenclass') ? $el.data("hiddenclass") : 'is--hidden'; 2588 2589 $(targetElementForClass).addClass(classForHiddenState); 2590 2591 var forch = function() { 2592 var f, 2593 dataForch = $el.attr('data-forch'); 2594 // check if data-forch attribute is added 2595 if( typeof dataForch !== 'undefined' && dataForch != ''){ 2596 // check if it's a numeric value 2597 if( !isNaN(parseFloat(dataForch)) && isFinite(dataForch) ){ 2598 f = parseInt(dataForch); 2599 } 2600 // or an id/class of an element. 2601 else { 2602 var specifiedElement = $(dataForch).first(); 2603 // check if element exists 2604 if(specifiedElement && specifiedElement.length > 0) { 2605 // get it's top offset 2606 f = specifiedElement.offset().top; 2607 } 2608 else { 2609 f = defaultForch; 2610 } 2611 } 2612 } 2613 // otherwise just add the default 2614 else { 2615 f = defaultForch; 2616 } 2617 return f; 2618 }; 2619 2620 // Check if page is scrolled after the forch 2621 if(doc.scrollTop() > forch() ) { 2622 $(targetElementForClass).removeClass(classForHiddenState).addClass(classForVisibleState); 2623 visible = true; 2624 } 2625 2626 $(window).on('scroll', function() { 2627 // if page is scrolled after the forch add class 2628 if (!visible && doc.scrollTop() > forch() ) { 2629 $(targetElementForClass).removeClass(classForHiddenState).addClass(classForVisibleState); 2630 visible = true; 2631 } 2632 // if page is scrolled before the forch remove the class 2633 else if (visible && doc.scrollTop() < forch() ) { 2634 $(targetElementForClass).removeClass(classForVisibleState).addClass(classForHiddenState); 2635 visible = false; 2636 } 2637 }); 2638 }); 2639 2640 $('.zn_pb_editor_enabled .toggle-header').on('click', function(e){ 2641 e.preventDefault(); 2642 $(this).toggleClass('site-header--hide'); 2643 }); 2644 2645 // Check portfolio content 2646 $.each( $('.portfolio-item-desc-inner-compacted') , function(i, el){ 2647 var $el = $(el),
2648 collapseAt = $el.is('[data-collapse-at]') && $el.attr('data-collapse-at') ? $el.attr('data-collapse-at') : 150; 2649 if( $el.outerHeight() < parseInt(collapseAt) ){ 2650 $el.parent('.portfolio-item-desc').addClass('no-toggle'); 2651 } 2652 }); 2653 2654 if( $("html").hasClass("no-touch") ){ 2655 2656 // Check portfolio content 2657 $.each( $('.portfolio-item-content.affixcontent') , function(i, el){ 2658 2659 var $el = $(el); 2660 var portfolio_page = $el.closest('.hg-portfolio-item'); 2661 2662 portfolio_page.imagesLoaded( function() { 2663 2664 var el_size = $el.outerHeight(true), 2665 container_size = portfolio_page.outerHeight(true), 2666 container_offset = portfolio_page.offset().top, 2667 w_height = $(window).height(), 2668 max = container_size - el_size - 60, 2669 offset_top = 100, 2670 top = 0; 2671 2672 // Only start if the element is smaller than parent 2673 2674 $(window).scroll(function() { 2675 if( el_size < container_size && w_height > el_size ){ 2676 var w_scroll_top = $(window).scrollTop(); 2677 2678 // Start when scrolling bigger than top position 2679 if( w_scroll_top + offset_top >= container_offset ){ 2680 2681 // If reached bottom 2682 if( ( container_offset + container_size <= w_scroll_top + w_height ) ) { 2683 top = max; 2684 $el.css('top', top); 2685 } 2686 else if( ( container_offset + container_size + offset_top ) >= w_scroll_top ){ 2687 $el.addClass( 'stickit' ); 2688 top = w_scroll_top - container_offset + offset_top; 2689 $el.css('top', top); 2690 } 2691 else{ 2692 $el.removeClass( 'stickit' ); 2693 $el.css('top', ''); 2694 } 2695 } 2696 else{ 2697 $el.removeClass( 'stickit' ); 2698 $el.css('top', ''); 2699 2700 } 2701 } 2702 }).scroll(); 2703 2704 2705 $(window).on('debouncedresize', function(){ 2706 el_size = $el.outerHeight(true), 2707 container_size = portfolio_page.outerHeight(true), 2708 container_offset = portfolio_page.offset().top, 2709 w_height = $(window).height(), 2710 max = container_size - el_size - 60, 2711 offset_top = 100, 2712 top = 0; 2713 }); 2714 }); 2715 2716 }); 2717 } 2718 2719 }); // doc.ready end // 2720 2721})(jQuery); 2722 2723if (navigator.userAgent.match(/IEMobile\/10\.0/)) { 2724 var msViewportStyle = document.createElement("style"); 2725 msViewportStyle.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")); 2726 document.getElementsByTagName("head")[0].appendChild(msViewportStyle); 2727} 2728var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 2729if(isSafari){ 2730 document.getElementsByTagName('body')[0].className+=' is-safari'; 2731} 2732 2733/*jshint browser:true */ 2734/*! 2735 * FitVids 1.1 2736 * 2737 * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 2738 * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 2739 * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 2740 * 2741 */ 2742!function(t){"use strict";t.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0],a=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}",d=document.createElement("div");d.innerHTML='<p>x</p><style id="fit-vids-style">'+a+"</style>",r.appendChild(d.childNodes[1])}return e&&t.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var a=t(this).find(e.join(","));a=a.not("object object"),a=a.not(r),a.each(function(e){var i=t(this);if(!(i.parents(r).length>0||"embed"===this.tagName.toLowerCase()&&i.parent("object").length||i.parent(".fluid-width-video-wrapper").length)){i.css("height")||i.css("width")||!isNaN(i.attr("height"))&&!isNaN(i.attr("width"))||(i.attr("height",9),i.attr("width",16));var a="object"===this.tagName.toLowerCase()||i.attr("height")&&!isNaN(parseInt(i.attr("height"),10))?parseInt(i.attr("height"),10):i.height(),d=isNaN(parseInt(i.attr("width"),10))?i.width():parseInt(i.attr("width"),10),o=a/d;if(!i.attr("id")){var h="fitvid"+e;i.attr("id",h)}i.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*o+"%"),i.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto); 2743;
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.