1/* 2 * King Composer 3 * 4 * URI KingComposer.com 5 * 6 * Copyright king-theme.com 7 * 8 * 9*/ 10 11var kc_front = ( function($){ 12 13 jQuery.extend( jQuery.easing, { 14 easeInOutQuart: function (x, t, b, c, d) { 15 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 16 return -c/2 * ((t-=2)*t*t*t - 2) + b; 17 }, 18 }); 19 20 return { 21 22 win_height : 0, 23 24 win_width : 0, 25 26 body : $('body'), 27 28 parallax_timer : null, 29 30 init : function(){ 31 32 var parallaxable = $('div[data-kc-parallax="true"]'); 33 if( parallaxable.length > 0 ) 34 { 35 parallaxable.each( function(){ 36 var speed = $(this).data('speed')*0.4; 37 $(this).parallax("50%", speed); 38 }); 39 } 40 41 this.accordion(); 42 43 this.tabs(); 44 45 this.youtube_row_background.init(); 46 if( undefined !== window.kc_row_action ){ 47 $( window ).on( 'resize', kc_row_action ); 48 $( window ).on( 'load', kc_row_action ); 49 } 50 if( window.location.href.indexOf('#') > -1 ){ 51 $('a[href="#'+window.location.href.split('#')[1]+'"]').trigger('click'); 52 } 53 54 this.google_maps(); 55 56 this.image_gallery.slider(); 57 58 this.image_gallery.masonry(); 59 60 this.carousel_images(); 61 62 this.carousel_post(); 63 64 this.countdown_timer(); 65 66 this.piechar.init(); 67 68 this.progress_bar.run(); 69 70 this.ajax_action(); 71 }, 72 73 refresh: function( el ){ 74 75 setTimeout( function( el){ 76 77 kc_front.piechar.update( el ); 78 kc_front.progress_bar.update( el ); 79 kc_front.image_gallery.masonry_refresh( el ); 80 81 if($('.kc_video_play').length > 0){ 82 kc_video_play.refresh( el ); 83 } 84 85 }, 100, el ); 86 87 }, 88 89 google_maps: function( wrp ){ 90 91 $('.kc_google_maps').each( function(){ 92 93 if( $(this).data('loaded') === true ) 94 return; 95 else $(this).data({ 'loaded' : true }); 96 97 var $_this = $( this ); 98 99 $_this.find('.close').on('click', function(){ 100 $_this.find('.map_popup_contact_form').toggleClass( "hidden" ); 101 $_this.find('.show_contact_form').fadeIn('slow'); 102 }); 103 104 $_this.find('.show_contact_form').on('click', function(){ 105 $_this.find('.map_popup_contact_form').toggleClass( "hidden" ); 106 $_this.find('.show_contact_form').fadeOut('slow'); 107 }); 108 }); 109 }, 110 111 accordion: function( wrp ){ 112 113 $('.kc_accordion_wrapper').each(function(){ 114 115 if( $(this).data('loaded') === true ) 116 return; 117 else $(this).data({ 'loaded' : true }); 118 119 var active = $(this).data('tab-active')!==undefined?($(this).data('tab-active')-1):0; 120 121 $( this ).find('>div.kc_accordion_section>h3.kc_accordion_header>a').off('click').on('click',function( e ){ 122 123 var wrp = $(this).closest('.kc_accordion_wrapper'), 124 section = $(this).closest('.kc_accordion_section'), 125 allowopenall = (true === wrp.data('allowopenall')) ? true : false, 126 changed = section.find('>h3.kc_accordion_header').hasClass('ui-state-active'); 127 128 if( allowopenall === false ){ 129 130 wrp.find( '>.kc_accordion_section>.kc_accordion_content' ).slideUp(); 131 132 wrp.find('>h3.kc_accordion_header').removeClass('ui-state-active'); 133 134 section.find('>.kc_accordion_content').stop().slideDown( 'normal', function(){ $(this).css({height:''}) } ); 135 section.find('>h3.kc_accordion_header').addClass('ui-state-active'); 136 137 }else{ 138 139 if( section.find('>h3.kc_accordion_header').hasClass('ui-state-active') ){ 140 section.find('>.kc_accordion_content').stop().slideUp(); 141 section.find('>h3.kc_accordion_header').removeClass('ui-state-active'); 142 }else{ 143 section.find('>.kc_accordion_content').stop().slideDown( 'normal', function(){ $(this).css({height:''}) } ); 144 section.find('>h3.kc_accordion_header').addClass('ui-state-active'); 145 } 146 147 } 148 149 if( changed != section.find('>h3.kc_accordion_header').hasClass('ui-state-active') ) 150 kc_front.refresh( section.find('>.kc_accordion_content') ); 151 152 e.preventDefault(); 153 154 var index = $(this).closest('.kc_accordion_section'); 155 index = index.parent().find('>.kc_accordion_section').index( index.get(0) ); 156 157 $(this).closest('.kc_accordion_wrapper').data({'tab-active':(index+1)}); 158 159 }).eq(active).trigger('click'); 160 161 }); 162 }, 163 164 tabs: function( wrp ){ 165 166 $('.kc_tabs > .kc_wrapper').each( function( index ){ 167 168 if( $(this).data('loaded') === true ) 169 return; 170 else $(this).data({ 'loaded' : true }); 171 172 var $_this = $(this), 173 tab_group = $_this.parent('.kc_tabs.group'), 174 tab_event = ('yes' === tab_group.data('open-on-mouseover')) ? 'mouseover' : 'click', 175 effect_option = ('yes' === tab_group.data('effect-option')) ? true : false, 176 active_section = parseInt( tab_group.data('tab-active') )-1; 177 178 $( this ).find('>.ui-tabs-nav>li') 179 .off('click') 180 .on( 'click', function(e){ 181 e.preventDefault(); 182 } ) 183 .off( tab_event ) 184 .on( tab_event, function(e){ 185 186 if( $(this).hasClass('ui-tabs-active') ){ 187 e.preventDefault(); 188 return; 189 } 190 191 var labels = $(this).closest('.kc_tabs_nav,.ui-tabs-nav').find('>li'), 192 index = labels.index( this ), 193 tab_list = $(this).closest('.kc_wrapper').find('>.kc_tab'), 194 new_panel = tab_list.eq( index ); 195
196 labels.removeClass('ui-tabs-active'); 197 $(this).addClass('ui-tabs-active'); 198 199 tab_list.removeClass('ui-tabs-body-active'); 200 new_panel.addClass('ui-tabs-body-active'); 201 202 if( effect_option === true) 203 new_panel.css({'opacity':0}).animate({opacity:1}); 204 205 e.preventDefault(); 206 207 $(this).closest('.kc_tabs').data({'tab-active':(index+1)}); 208 209 }).eq( active_section ).trigger( tab_event ); 210 211 }); 212 213 $('.kc_tabs.kc-tabs-slider .kc-tabs-slider-nav li').each(function( index ){ 214 215 if( $(this).data('loaded') === true ) 216 return; 217 else $(this).data({ 'loaded' : true }); 218 219 $( this ).on( 'click', index, function( e ){ 220 $(this).parent().find('.kc-title-active').removeClass('kc-title-active'); 221 $(this).addClass('kc-title-active'); 222 $(this).closest('.kc-tabs-slider').find('.owl-carousel').trigger('owl.goTo', e.data); 223 e.preventDefault(); 224 $(this).closest('.kc_tabs').data({'active':e.data}); 225 }); 226 if( index === 0 ) 227 $( this ).addClass('kc-title-active'); 228 }); 229 230 kc_front.owl_slider(); 231 232 }, 233 234 youtube_row_background: { 235 236 init: function(){ 237 238 $( '.kc_row' ).each( function () { 239 var $row = $( this ), 240 youtubeUrl, 241 youtubeId; 242 243 if ( $row.data( 'kc-video-bg' ) ) { 244 youtubeUrl = $row.data( 'kc-video-bg' ); 245 youtubeId = kc_front.youtube_row_background.getID( youtubeUrl ); 246 247 if ( youtubeId ) { 248 $row.find( '.kc_wrap-video-bg' ).remove(); 249 kc_front.youtube_row_background.add( $row, youtubeId ); 250 } 251 252 } else { 253 $row.find( '.kc_wrap-video-bg' ).remove(); 254 } 255 } ); 256 }, 257 258 getID: function ( url ) { 259 if ( 'undefined' === typeof(url) ) { 260 return false; 261 } 262 263 var id = url.match( /(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/ ); 264 if ( null !== id ) { 265 return id[ 1 ]; 266 } 267 268 return false; 269 }, 270 271 add: function( $obj, youtubeId, counter ) { 272 273 if( YT === undefined ) 274 return; 275 276 if ( 'undefined' === typeof( YT.Player ) ) { 277 278 counter = 'undefined' === typeof( counter ) ? 0 : counter; 279 if ( counter > 100 ) { 280 console.warn( 'Too many attempts to load YouTube api' ); 281 return; 282 } 283 284 setTimeout( function () { 285 kc_front.youtube_row_background.add( $obj, youtubeId, counter++ ); 286 }, 100 ); 287 288 return; 289 } 290 291 var player, 292 $container = $obj.prepend( '<div class="kc_wrap-video-bg"><div class="ifr_inner"></div></div>' ).find( '.ifr_inner' ); 293 294 player = new YT.Player( $container[0], { 295 width: '100%', 296 height: '100%', 297 videoId: youtubeId, 298 playerVars: { 299 playlist: youtubeId, 300 iv_load_policy: 3, 301 enablejsapi: 1, 302 disablekb: 1, 303 autoplay: 1, 304 controls: 0, 305 showinfo: 0, 306 rel: 0, 307 loop: 1 308 }, 309 events: { 310 onReady: function ( e ) { 311 e.target.mute().setLoop( true ); 312 } 313 } 314 } ); 315 316 kc_front.youtube_row_background.resize( $obj ); 317 318 $( window ).on( 'resize', function () { 319 kc_front.youtube_row_background.resize( $obj ); 320 } ); 321 }, 322 323 resize: function( $obj ) { 324 325 var ratio = 1.77, ifr_w, ifr_h, 326 marginLeft, marginTop, 327 inner_width = $obj.innerWidth(), 328 inner_height = $obj.innerHeight(); 329 330 if ( ( inner_width / inner_height ) < ratio ) { 331 ifr_w = inner_height * ratio; 332 ifr_h = inner_height; 333 } else { 334 ifr_w = inner_width; 335 ifr_h = inner_width * (1 / ratio); 336 } 337 338 marginLeft = - Math.round( ( ifr_w - inner_width ) / 2 ) + 'px'; 339 marginTop = - Math.round( ( ifr_h - inner_height ) / 2 ) + 'px'; 340 341 ifr_w += 'px'; 342 ifr_h += 'px'; 343 344 $obj.find( '.kc_wrap-video-bg iframe' ).css( { 345 maxWidth: '1000%', 346 marginLeft: marginLeft, 347 marginTop: marginTop, 348 width: ifr_w, 349 height: ifr_h 350 } ); 351 } 352 353 }, 354 355 image_gallery : { 356 357 slider: function( wrp ){ 358 /* 359 * OWL slider 360 * For each item OWL slider 361 */ 362 $( '.kc-owlslider' ).each( function( index ){ 363 364 if( $(this).data('loaded') === true ) 365 return; 366 else $(this).data({ 'loaded' : true }); 367 368 var slider_options = $( this ).data('slide_options'), 369 _autoplay = ( 'yes' === slider_options.auto_rotate ) ? true : false, 370 _navigation = ( 'yes' === slider_options.navigation ) ? true : false, 371 _pagination = ( 'yes' === slider_options.pagination ) ? true : false;
372 373 $( this ).owlCarousel({ 374 375 autoPlay : _autoplay, 376 navigation : _navigation, // Show next and prev buttons 377 pagination : _pagination, 378 slideSpeed : 300, 379 paginationSpeed : 400, 380 singleItem :true, 381 autoHeight : true, 382 items : 1 383 384 }); 385 386 }); 387 }, 388 389 masonry : function( wrp ){ 390 391 if( wrp === undefined ) 392 wrp = kc_front.body; 393 394 wrp.find('.kc_image_gallery').each(function(){ 395 var $container = $( this ); 396 397 if(( 'yes' === $( this ).data('image_masonry')) ){ 398 $container.imagesLoaded( function(){ 399 $container.masonry({ 400 itemSelector : '.item-grid' 401 }); 402 }); 403 } 404 405 }); 406 407 if( typeof( $.prettyPhoto ) == 'object' ){ 408 $("a[rel^='prettyPhoto']").prettyPhoto({ 409 social_tools: false 410 }); 411 } 412 413 }, 414 415 masonry_refresh : function( el ){ 416 417 el.find('.kc_image_gallery').each(function(){ 418 419 var $container = $( this ); 420 var load = $container.data('load'); 421 422 if(true !== load){ 423 if(( 'yes' === $( this ).data('image_masonry')) ){ 424 $container.imagesLoaded( function(){ 425 $container.masonry({ 426 itemSelector : '.item-grid' 427 }); 428 }); 429 } 430 431 $container.attr('data-load', true); 432 } 433 434 }); 435 436 if( typeof( $.prettyPhoto ) == 'object' ){ 437 $("a[rel^='prettyPhoto']").prettyPhoto({ 438 social_tools: false 439 }); 440 } 441 442 } 443 444 }, 445 446 carousel_images : function( wrp ){ 447 /* 448 * Carousel images 449 * For each item Carousel images 450 */ 451 452 $( '.kc-carousel-images' ).each( function( index ){ 453 454 if( $(this).data('loaded') === true ) 455 return; 456 else $(this).data({ 'loaded' : true }); 457 458 var options = $( this ).data('owl-i-options'), 459 _auto_play = ( 'yes' === options.autoplay ) ? true : false, 460 _delay = ( options.delay !== undefined ) ? options.delay : 8, 461 _navigation = ( 'yes' === options.navigation ) ? true : false, 462 _pagination = ( 'yes' === options.pagination ) ? true : false, 463 _speed = options.speed, 464 _items = options.items, 465 _auto_height = ( 'yes' === options.autoheight ) ? true : false, 466 _show_thumb = ( 'yes' === options.showthumb ) ? true : false, 467 _progress_bar = ( 'yes' === options.progressbar ) ? true : false, 468 _singleItem = false; 469 470 471 var progressBar = function(){}; 472 var moved = function(){}; 473 var pauseOnDragging = function(){}; 474 475 if( true === _auto_height || true === _progress_bar || true === _show_thumb ) 476 _singleItem = true; 477 478 if(_auto_play) 479 _auto_play = parseInt( _delay )*1000; 480 481 if( true === _progress_bar ) 482 { 483 484 var time = _delay; // time in seconds 485 486 var $progressBar, 487 $bar, 488 $elem, 489 isPause, 490 tick, 491 percentTime; 492 493 494 progressBar = function( elem ){ 495 $elem = elem; 496 //build progress bar elements 497 buildProgressBar(); 498 //start counting 499 start(); 500 }; 501 502 var buildProgressBar = function(){ 503 504 $progressBar = $("<div>",{ 505 class:"progressBar" 506 }); 507 508 $bar = $("<div>",{ 509 class:"bar" 510 }); 511 512 $progressBar.append($bar).prependTo($elem); 513 514 }; 515 516 var start = function() { 517 //reset timer 518 percentTime = 0; 519 isPause = false; 520 //run interval every 0.01 second 521 tick = setInterval(interval, 10); 522 }; 523 524 525 var interval = function() { 526 if(isPause === false){ 527 percentTime += 1 / time; 528 529 $bar.css({ 530 width: percentTime+"%" 531 }); 532 //if percentTime is equal or greater than 100 533 534 if(percentTime >= 100){ 535 //slide to next item 536 $elem.trigger('owl.next'); 537 } 538 } 539 }; 540 541 pauseOnDragging = function (){ 542 isPause = true; 543 }; 544 545 moved = function(){ 546 //clear interval 547 clearTimeout(tick); 548 //start again 549 start(); 550 }; 551 } 552 553 if( true !== _show_thumb) 554 { 555 $( this ).owlCarousel({ 556 557 autoPlay : _auto_play, 558 navigation : _navigation, 559 pagination : _pagination, 560 slideSpeed : _speed, 561 paginationSpeed : _speed, 562 singleItem : _singleItem, 563 autoHeight : _auto_height, 564 items : _items, 565 afterInit : progressBar, 566 afterMove : moved, 567 startDragging : pauseOnDragging 568 569 }); 570 } 571 else 572 { 573 var sync1 = $( this ); 574 var sync2 = sync1.next('.kc-sync2'); 575 576 var syncPosition = function(el){ 577 var current = this.currentItem; 578 579 $(sync2) 580 .find(".owl-item") 581 .removeClass("synced") 582 .eq(current) 583 .addClass("synced"); 584 585 if($(sync2).data("owlCarousel") !== undefined) 586 { 587 center(current); 588 } 589 }; 590 591 sync2.on("click", ".owl-item", function(e){ 592 e.preventDefault(); 593 594 var number = $(this).data("owlItem"); 595 sync1.trigger("owl.goTo",number); 596 }); 597 598 var center = function(number){ 599 var sync2visible = sync2.data("owlCarousel").owl.visibleItems; 600 var num = number; 601 var found = false;
602 603 for(var i in sync2visible){ 604 if(num === sync2visible[i]) 605 { 606 found = true; 607 } 608 } 609 610 if(found===false){ 611 if( num> sync2visible[sync2visible.length-1] ) 612 { 613 sync2.trigger("owl.goTo", num - sync2visible.length+2); 614 }else 615 { 616 if(num - 1 === -1){ 617 num = 0; 618 } 619 620 sync2.trigger("owl.goTo", num); 621 } 622 } 623 else if(num === sync2visible[sync2visible.length-1]) 624 { 625 sync2.trigger("owl.goTo", sync2visible[1]); 626 } 627 else if(num === sync2visible[0]) 628 { 629 sync2.trigger("owl.goTo", num-1); 630 } 631 632 }; 633 634 sync1.owlCarousel({ 635 autoPlay : _auto_play, 636 singleItem : _singleItem, 637 slideSpeed : _speed, 638 paginationSpeed : _speed, 639 navigation : _navigation, 640 pagination : _pagination, 641 afterAction : syncPosition, 642 responsiveRefreshRate : 200, 643 autoHeight : _auto_height, 644 afterInit : progressBar, 645 afterMove : moved, 646 startDragging : pauseOnDragging 647 }); 648 649 sync2.owlCarousel({ 650 items : 20, 651 itemsDesktop : [1199, 15], 652 itemsDesktopSmall : [979, 12], 653 itemsTablet : [768, 6], 654 itemsMobile : [479, 5], 655 pagination : _pagination, 656 responsiveRefreshRate : 100, 657 afterInit : function(el){ 658 el.find(".owl-item").eq(0).addClass("synced"); 659 } 660 }); 661 } 662 663 }); 664 665 if( typeof( $.prettyPhoto ) == 'object' ){ 666 $("a[rel^='prettyPhoto']").prettyPhoto({ 667 social_tools: false 668 }); 669 } 670 671 }, 672 673 carousel_post : function( wrp ){ 674 675 kc_front.owl_slider( '.kc-owl-post-carousel' ); 676 677 }, 678 679 countdown_timer : function(){ 680 681 $( '.kc-countdown-timer' ).each( function( index ){ 682 var countdown_data = $( this ).data('countdown'); 683 684 $(this).countdown(countdown_data.date, function(event) { 685 $(this).html(event.strftime(countdown_data.template)); 686 }); 687 688 }); 689 }, 690 691 piechar : { 692 693 init: function(){ 694 695 $('.kc_piechart').each(function(index){ 696 697 $( this ).viewportChecker({ 698 699 callbackFunction: function( elm ){ 700 701 kc_front.piechar.load( elm ); 702 703 }, 704 705 classToAdd: 'kc-pc-loaded' 706 707 }); 708 709 }); 710 }, 711 712 load : function( el ){ 713 714 if( el.parent('div').width() < 10 ) 715 return 0; 716 717 var _size = el.data( 'size' ), 718 _linecap = ( 'yes' === el.data( 'linecap' )) ? 'round' : 'square', 719 _barColor = el.data( 'barcolor' ), 720 _trackColor = el.data( 'trackcolor' ), 721 _autowidth = el.data( 'autowidth' ), 722 _linewidth = el.data( 'linewidth' ); 723 724 if('yes' === _autowidth){ 725 _size = el.parent('div').width(); 726 el.data( 'size', _size ); 727 el.find('.percent').css({ 'line-height' : _size + 'px' }); 728 } 729 730 //Fix percent middle 731 var percent_width = el.find('.percent').width() + el.find('.percent:after').width(); 732 var percent_height = el.find('.percent').height(); 733 734 el.easyPieChart({ 735 736 barColor: _barColor, 737 trackColor: _trackColor, 738 lineCap: _linecap, 739 easing: 'easeOutBounce', 740 741 onStep: function(from, to, percent) { 742 743 $(this.el).find('.percent').text(Math.round(percent)); 744 $(this.el).find('.percent').show(); 745 $( this.el ).css({'width': _size, 'height': _size}); 746 747 }, 748 749 scaleLength: 0, 750 lineWidth: _linewidth, 751 size: _size, 752 753 }); 754 755 }, 756 757 update: function( el ){ 758 759 $('.kc_piechart').each( function(){ 760 761 if( $(this).data('loaded') === true ) 762 return; 763 else $(this).data({ 'loaded' : true }); 764 765 kc_front.piechar.load( $( this ) ); 766 767 }); 768 769 } 770 771 }, 772 773 progress_bar : { 774 775 run: function(){ 776 777 $('.kc_progress_bars').each(function(){ 778 779 $( this ).viewportChecker({ 780 781 callbackFunction: function( el ){ 782 783 kc_front.progress_bar.update( el ); 784 785 }, 786 classToAdd : 'kc-pb-loaded' 787 }); 788 789 }); 790 }, 791 792 update: function( el ){ 793 794 $('.kc-progress-bar .kc-ui-progress').each(function(){ 795 796 if( $(this).data('loaded') === true ) 797 return; 798 else $(this).data({ 'loaded' : true }); 799 800 $( this ).css({ width: '5%' }). 801 stop(). 802 animate({ 803 width: this.getAttribute('data-value')+'%' 804 },{ 805 duration: parseInt( this.getAttribute('data-speed') ), 806 easing : 'easeInOutQuart', 807 step : function( st, tl ){ 808 if( tl.now/tl.end > 0.3 ) 809 this.getElementsByClassName('ui-label')[0].style.opacity = tl.now/tl.end; 810 } 811 } 812 ).find('.ui-label').css({opacity:0}
812); 813 814 }); 815 816 } 817 }, 818 819 ajax_action : function(){ 820 821 $('.kc_facebook_recent_post').each(function(){ 822 823 if( this.getAttribute('data-cfg') === null || 824 this.getAttribute('data-cfg') === undefined || 825 this.getAttribute('data-cfg') === '' ) 826 return; 827 828 var $_this = $( this ), 829 data_send = { 830 action: 'kc_facebook_recent_post', 831 cfg: $( this ).data( 'cfg' ) 832 }; 833 834 this.removeAttribute('data-cfg'); 835 836 $.ajax({ 837 url: kc_script_data.ajax_url, 838 method: 'POST', 839 dataType: 'json', 840 data: data_send, 841 success: function( response_data ){ 842 $_this.find('ul').html(response_data.html).before(response_data.header_html); 843 } 844 }); 845 846 }); 847 848 /* 849 * instagram feed images 850 * Send data to shortcode 851 */ 852 $('.kc_wrap_instagram').each(function(index){ 853 854 if( this.getAttribute('data-cfg') === null || 855 this.getAttribute('data-cfg') === undefined || 856 this.getAttribute('data-cfg') === '' ) 857 return; 858 859 var $_this = $( this ), 860 data_send = { 861 action: 'kc_instagrams_feed', 862 cfg: $( this ).data( 'cfg' ) 863 }; 864 865 this.removeAttribute('data-cfg'); 866 867 $.ajax({ 868 url: kc_script_data.ajax_url, 869 method: 'POST', 870 dataType: 'json', 871 data: data_send, 872 success: function( response_data ){ 873 $_this.find('ul').html(response_data.html); 874 } 875 }); 876 }); 877 878 /* 879 * Twitter feed sider 880 * For each item Twitter feed sider 881 */ 882 $( '.kc_twitter_feed' ).each( function( index ) { 883 884 if( this.getAttribute('data-cfg') === null || 885 this.getAttribute('data-cfg') === undefined || 886 this.getAttribute('data-cfg') === '' ) 887 return; 888 889 var $_this = $( this ), 890 atts_data = { 891 action: 'kc_twitter_timeline', 892 cfg: $( this ).data( 'cfg' ) 893 }; 894 895 this.removeAttribute('data-cfg'); 896 897 var owl_option = $( this ).data( 'owl_option' ); 898 899 $.ajax({ 900 url: kc_script_data.ajax_url, 901 method: 'POST', 902 dataType: 'json', 903 data: atts_data, 904 success: function( response_data ){ 905 var display_style = $_this.data( 'display_style' ); 906 907 $_this.find('.result_twitter_feed').html( response_data.html ); 908 909 $_this.find('.result_twitter_feed').before('<div class="button_follow_wrap">'+response_data.header_data+'</div>'); 910 911 var _navigation = ( 'yes' === owl_option.show_navigation )? true : false, 912 _pagination = ( 'yes' === owl_option.show_pagination )? true : false, 913 _autoHeight = ( 'yes' === owl_option.auto_height )? true : false; 914 915 if( 2 === display_style ){ 916 $_this.find('.kc-tweet-owl').owlCarousel({ 917 navigation : _navigation, 918 pagination : _pagination, 919 slideSpeed : 300, 920 paginationSpeed : 400, 921 singleItem : true, 922 items : 1, 923 autoHeight : _autoHeight 924 }); 925 } 926 } 927 }); 928 929 }); 930 }, 931 932 owl_slider : function(){ 933 934 if( typeof $().owlCarousel != 'function' ) 935 return; 936 937 $('[data-owl-options]').each( function( index ){ 938 939 var options = $( this ).data('owl-options'); 940 941 if( typeof options !== 'object' ) 942 return; 943 944 if( $(this).data('loaded') === true ) 945 return; 946 else $(this).data({ 'loaded' : true }); 947 948 $( this ).attr({'data-owl-options':null}); 949 950 var _autoplay = ( 'yes' === options.autoplay ) ? true : false, 951 _navigation = ( 'yes' === options.navigation ) ? true : false, 952 _pagination = ( 'yes' === options.pagination ) ? true : false, 953 _speed = ( options.speed!==undefined ) ? options.speed : 450, 954 _items = ( options.items!==undefined ) ? options.items:1, 955 _tablet = ( options.tablet!==undefined ) ? options.tablet:1, 956 _mobile = ( options.mobile!==undefined ) ? options.mobile:1, 957 _autoheight = ( 'yes' === options.autoheight ) ? true : false, 958 _showthumb = ( 'yes' === options.showthumb ) ? true : false, 959 _singleItem = false; 960 961 if(_autoheight === true){ 962 _singleItem = true; 963 _items = 1; 964 } 965 966 $( this ).owlCarousel({ 967 autoPlay : _autoplay, 968 navigation : _navigation, 969 pagination : _pagination, 970 showthumb : _showthumb, 971 slideSpeed : _speed, 972 paginationSpeed : _speed, 973 singleItem : _singleItem, 974 autoHeight : _autoheight, 975 items : _items, 976 itemsCustom : false, 977 itemsDesktop : [1199,_items], 978 itemsDesktopSmall : [980,_tablet], 979 itemsTablet: [640,_mobile], 980 itemsTabletSmall: false, 981 itemsMobile : [480,_mobile], 982 }); 983 984 }); 985 986 if( typeof $.prettyPhoto == 'function' ){ 987 $("a[rel^='prettyPhoto']").prettyPhoto({ 988 social_tools: false 989 }); 990 } 991 992 }, 993 994 kc_end : {} 995 996 }; 997 998}(jQuery)); 999 1000jQuery( document ).ready(function($){ kc_front.init($); }); 1001 1002/* 1003Plugin: jQuery Parallax 1004Version 1.1.3 1005Author: Ian Lunn 1006Twitter: @IanLunn 1007Author URL: http://www.ianlunn.co.uk/ 1008Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 1009 1010Dual licensed under the MIT and GPL licenses: 1011http://www.opensource.org/licenses/mit-license.php 1012http://www.gnu.org/licenses/gpl.html 1013*/ 1014 1015(function( $ ){ 1016 var $window = $(window); 1017 var windowHeight = $window.height(); 1018 1019 $window.resize(function () { 1020 windowHeight = $window.height(); 1021 }); 1022 1023 $.fn.parallax = function(xpos, speedFactor, outerHeight) { 1024 var $this = $(this); 1025 var getHeight; 1026 var firstTop; 1027 var paddingTop = 0; 1028 1029 //get the starting position of each element to have parallax applied to it 1030 $this.each(function(){ 1031 firstTop = $this.offset().top; 1032 }); 1033 1034 if (outerHeight) { 1035 getHeight = function(jqo) { 1036 return jqo.outerHeight(true); 1037 }; 1038 } else { 1039 getHeight = function(jqo) { 1040 return jqo.height(); 1041 }; 1042 } 1043 1044 // setup defaults if arguments aren't specified 1045 if (arguments.length < 1 || xpos === null) xpos = "50%"; 1046 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 1047 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 1048 1049 // function to be called whenever the window is scrolled or resized
1050 function update(){ 1051 var pos = $window.scrollTop(); 1052 1053 $this.each(function(){ 1054 var $element = $(this); 1055 var top = $element.offset().top; 1056 var height = getHeight($element); 1057 1058 // Check if totally above or totally below viewport 1059 if (top + height < pos || top > pos + windowHeight) { 1060 return; 1061 } 1062 1063 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 1064 }); 1065 } 1066 1067 $window.bind('scroll', update).resize(update); 1068 update(); 1069 }; 1070})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.