1(function($) { 2 3 'use strict'; 4 5 /*-------------------------------------------------------------- 6 ## Scripts initialization 7 --------------------------------------------------------------*/ 8 9 $(window).on('load', function() { 10 isotopMsSetup(); 11 preloader(); 12 youtubePlaylist(); 13 onePage(); 14 }); 15 16 $(document).on('qv_loader_stop', function() { 17 qtyStepper(); 18 }); 19 20 $(document).on('ready', function() { 21 scrollUp(); 22 primaryMenuSetup(); 23 lightGallery(); 24 $(window).trigger('resize'); 25 elementornegativeMargin(); 26 mobileMenu(); 27 isotopMsSetup(); 28 pageHeightOf404(); 29 swiperSlider(); 30 accordianSetup(); 31 modalVideo(); 32 tabs(); 33 modal(); 34 customSelectSetup(); 35 customQuantity(); 36 lineChart(); 37 roundChart(); 38 countDown(); 39 horizontalProgressBar(); 40 stickyFooter(); 41 beforeAfterSlider(); 42 googleMap(); 43 postVoteCount(); 44 tbSvgShape(); 45 appleTVeffect(); 46 qtyStepper(); 47 ajaxPagination(); 48 onePage(); 49 foodMenuList(); 50 parallax(); 51 searchModal(); 52 audioPlayerSetup(); 53 sectionScroll(); 54 zoomEffect(); 55 datePickerSetup(); 56 cursorPlus(); 57 }); 58 59 $(window).on('resize', function() { 60 mobileMenu(); 61 isotopMsSetup(); 62 pageHeightOf404(); 63 stickyFooter(); 64 beforeAfterSlider(); 65 }); 66 67 $(window).on('scroll', function() { 68 scrollFunction(); 69 horizontalProgressBar(); 70 stickyFooter(); 71 }); 72 73 $.exists = function(selector) { 74 return ($(selector).length > 0); 75 } 76 77 78 /*-------------------------------------------------------------- 79 ## Preloader 80 --------------------------------------------------------------*/ 81 82 function preloader() { 83 $(".tb-preloader-in").fadeOut(); 84 $(".tb-preloader").delay(150).fadeOut("slow"); 85 } 86 87 /*-------------------------------------------------------------- 88 ## Scroll Up 89 --------------------------------------------------------------*/ 90 91 function scrollUp() { 92 93 $('#tb-scrollup').on('click', function(e) { 94 e.preventDefault(); 95 $('html,body').animate({ 96 scrollTop: 0 97 }, 1000); 98 }); 99 100 } 101 /*-------------------------------------------------------------- 102 ## Elementor Negative Margin 103 --------------------------------------------------------------*/ 104 105 function elementornegativeMargin() { 106 $('.elementor-spacer-inner').parents('.elementor-row').addClass('removeNegativeMargin'); 107 } 108 109 /*-------------------------------------------------------------- 110 ## Primary Menu 111 --------------------------------------------------------------*/ 112 113 function primaryMenuSetup() { 114 $('.tb-main-nav').before('<button class="tb-m-menu-btn"><span></span></button>'); 115 $('.tb-m-menu-btn').on('click', function() { 116 $(this).toggleClass('tb-m-menu-btn-ext'); 117 $(this).siblings('.tb-main-nav').slideToggle('slow'); 118 $('.tb-full-screen-nav').toggleClass('tb-full-screen-active'); 119 $(this).parents('.tb-site-header.tb-style2.tb-type1').toggleClass('tb-active-sidenav'); 120 }); 121 122 $('.menu-item-has-children ').append('<button class="tb-plus tb-dropdown"></button>'); 123 $('.tb-dropdown').on('click', function() { 124 $(this).prev().slideToggle('slow'); 125 $(this).toggleClass('tb-plus tb-minus') 126 }); 127 // Mega Menu 128 $('.tb-mega-wrapper>li>a').removeAttr("href"); 129 $('.tb-mega-wrapper>li>a').on('click', function() { 130 $(this).siblings().slideToggle(); 131 $(this).toggleClass('tb-megamenu-plus'); 132 }); 133 134 $('.tb-solid-header.tb-sticky-header').before('<div class="tb-solid-header-height"></div>'); 135 136 if ($.exists('.tb-header-style13 .tb-promotion-bar')) { 137 $('.tb-header-style13').addClass('tb-remove-header-padding'); 138 } 139 } 140 141 function mobileMenu() { 142 if ($(window).width() <= 991) { 143 $('.tb-primary-nav').addClass('tb-m-menu').removeClass('tb-primary-nav'); 144 $('.tb-profile-toggle').addClass('tb-offset-menu'); 145 } else { 146 $('.tb-m-menu').addClass('tb-primary-nav').removeClass('tb-m-menu'); 147 $('.tb-profile-toggle').removeClass('tb-offset-menu'); 148 } 149 var solidHeaderHight = $('.tb-solid-header').height() + 'px'; 150 $('.tb-solid-header-height').css('height', solidHeaderHight); 151 152 // Transparent Header page 153 var pageHeadingPad = (($('.tb-site-header').height()) + 45) + 'px' 154 $('.tb-transparent-header+.tb-page-heading-wrap').css('padding-top', pageHeadingPad); 155 // Header Promo Bar 156 var reduseSolidHeaderHight = (($('.tb-solid-header').height()) - ($('.tb-promotion-bar').height())) + 'px'; 157 var redusePageHeadingPad = (($('.tb-site-header').height()) - ($('.tb-promotion-bar').height()) + 45) + 'px'; 158 $('.tb-promotion-cross').on('click', function() { 159 $(this).parents('.tb-promotion-bar').slideUp(400); 160 $(this).parents('.tb-site-header').siblings('.tb-solid-header-height').css('height', reduseSolidHeaderHight); 161 $(this).parents('.tb-site-header').addClass('tb-remove-promobar-active'); 162 }); 163 $('.tb-transparent-header .tb-promotion-cross').on('click', function() { 164 $('.tb-page-heading-wrap').css('padding-top', redusePageHeadingPad); 165 }); 166 // Header Style2 167 $('.tb-site-header.tb-style2').parents('body').addClass('tb-sidebar-parent'); 168 $('.tb-site-header.tb-style2.tb-type1').parents('body').addClass('tb-sidebar-parent-small'); 169 170 } 171 172 173 /*-------------------------------------------------------------- 174 ## Scroll Function 175 --------------------------------------------------------------*/ 176 177 function scrollFunction() { 178 var scroll = $(window).scrollTop(); 179 // For Small Header 180 if (scroll >= 10) { 181 $('.tb-site-header').addClass('small-height'); 182 } else { 183 $('.tb-site-header').removeClass('small-height'); 184 } 185 // Scroll Up 186 if (scroll >= 350) { 187 $("#tb-scrollup").addClass("scrollup-show"); 188 } else { 189 $("#tb-scrollup").removeClass("scrollup-show"); 190 } 191 } 192 193 194 /*-------------------------------------------------------------- 195 ## Footer Sticky 196 --------------------------------------------------------------*/ 197 198 function stickyFooter() { 199 // Sticky Footer 200 var footerHeight = ($('.tb-sticky-footer').height()); 201 var windowHeight = $(window).height(); 202 var footerHeightPx = footerHeight + 'px'; 203 $('.tb-content').css("margin-bottom", footerHeightPx); 204 if (footerHeight > windowHeight) { 205 $('body').addClass('tb-remove-sticky-footer'); 206 } 207 } 208 209 210 /*-------------------------------------------------------------- 211 ## Isotop Initialize 212 --------------------------------------------------------------*/ 213 214 function pageHeightOf404() { 215 if ($.exists('.tb-site-header')) { 216 var headerHeight = $('.tb-site-header').height(); 217 $('.tb-error-page').css('margin-top', -headerHeight); 218 $('.tb-error-page').css('padding-top', headerHeight); 219 } 220 } 221 222 223 /*-------------------------------------------------------------- 224 ## Isotop Initialize 225 --------------------------------------------------------------*/ 226 227 function isotopMsSetup() { 228 if ($.exists('.tb-isotop')) { 229 $('.tb-isotop').isotope({ 230 itemSelector: '.tb-isotop-item', 231 transitionDuration: '0.60s', 232 percentPosition: true, 233 masonry: { 234 columnWidth: '.tb-grid-sizer' 235 } 236 }); 237 /* Active Class of Portfolio*/ 238 $('.tb-isotop-filter ul li').on('click', function(event) { 239 $(this).siblings('.active').removeClass('active'); 240 $(this).addClass('active'); 241 event.preventDefault(); 242 }); 243 /*=== Portfolio filtering ===*/ 244 $('.tb-isotop-filter ul').on('click', 'a', function() { 245 var filterElement = $(this).attr('data-filter'); 246 $(this).parents('.tb-isotop-filter').next().isotope({ 247 filter: filterElement 248 }); 249 }); 250 } 251 } 252 253 254 /*-------------------------------------------------------------- 255 ## Swiper Slider 256 --------------------------------------------------------------*/ 257 258 function swiperSlider() { 259 260 261 $('.tb-slider').each(function() { 262 263 // Slick Variable 264 var $ts = $(this).find('.slick-container'); 265 var $slickActive = $(this).find('.slick-wrapper'); 266 267 // Auto Play 268 var autoPlayVar = parseInt($ts.attr('data-autoplay'), 10); 269 // Auto Play Time Out 270 var autoplaySpdVar = 3000; 271 if (autoPlayVar > 1) { 272 autoplaySpdVar = autoPlayVar; 273 autoPlayVar = 1; 274 } 275 // Slide Change Speed 276 var speedVar = parseInt($ts.attr('data-speed'), 10); 277 // Slider Loop 278 var loopVar = Boolean(parseInt($ts.attr('data-loop'), 10)); 279 // Slider Center 280 var centerVar = Boolean(parseInt($ts.attr('data-center'), 10)); 281 // Pagination 282 var paginaiton = $(this).children().hasClass('pagination'); 283 // Slide Per View
284 var slidesPerView = $ts.attr('data-slides-per-view'); 285 if (slidesPerView == 1) { 286 slidesPerView = 1; 287 } 288 if (slidesPerView == 'responsive') { 289 var slidesPerView = parseInt($ts.attr('data-add-slides'), 10); 290 var lgPoint = parseInt($ts.attr('data-lg-slides'), 10); 291 var mdPoint = parseInt($ts.attr('data-md-slides'), 10); 292 var smPoint = parseInt($ts.attr('data-sm-slides'), 10); 293 var xsPoing = parseInt($ts.attr('data-xs-slides'), 10); 294 } 295 296 // Fade Slider 297 var fadeVar = parseInt($($ts).attr('data-fade-slide')); 298 (fadeVar === 1) ? (fadeVar = true) : (fadeVar = false); 299 300 301 // Slick Active Code 302 $slickActive.slick({ 303 infinite: true, 304 autoplay: autoPlayVar, 305 dots: paginaiton, 306 centerPadding: '0', 307 speed: speedVar, 308 infinite: loopVar, 309 autoplaySpeed: autoplaySpdVar, 310 centerMode: centerVar, 311 prevArrow: $(this).find('.slick-arrow-left'), 312 nextArrow: $(this).find('.slick-arrow-right'), 313 appendDots: $(this).find('.pagination'), 314 fade: fadeVar, 315 slidesToShow: slidesPerView, 316 variableWidth: false, 317 responsive: [{ 318 breakpoint: 1600, 319 settings: { 320 slidesToShow: lgPoint 321 } 322 }, 323 { 324 breakpoint: 1200, 325 settings: { 326 slidesToShow: mdPoint 327 } 328 }, 329 { 330 breakpoint: 992, 331 settings: { 332 slidesToShow: smPoint 333 } 334 }, 335 { 336 breakpoint: 768, 337 settings: { 338 slidesToShow: xsPoing 339 } 340 } 341 ] 342 }); 343 }) 344 345 346 347 348 349 } 350 351 352 /*-------------------------------------------------------------- 353 ## Accordian 354 --------------------------------------------------------------*/ 355 356 function accordianSetup() { 357 var $this = $(this); 358 $('.tb-accordian').children('.tb-accordian-body').hide(); 359 $('.tb-accordian.active').children('.tb-accordian-body').show(); 360 $('.tb-accordian-title').on('click', function() { 361 $(this).parent('.tb-accordian').siblings().children('.tb-accordian-body').slide
361Up(250); 362 $(this).siblings().slideDown(250); 363 /* Accordian Active Class */ 364 $(this).parents('.tb-accordian').addClass('active'); 365 $(this).parent('.tb-accordian').siblings().removeClass('active'); 366 }); 367 } 368 369 370 /*-------------------------------------------------------------- 371 ## Modal Video 372 --------------------------------------------------------------*/ 373 374 function modalVideo() { 375 $(document).on('click', '.tb-video-open', function(e) { 376 e.preventDefault(); 377 var video = $(this).attr('href'); 378 $('.tb-video-popup-container iframe').attr('src', video); 379 $('.tb-video-popup').addClass('active'); 380 381 }); 382 $('.tb-video-popup-close, .tb-video-popup-layer').on('click', function(e) { 383 $('.tb-video-popup').removeClass('active'); 384 $('html').removeClass('overflow-hidden'); 385 $('.tb-video-popup-container iframe').attr('src', 'about:blank') 386 e.preventDefault(); 387 }); 388 } 389 390 391 /*-------------------------------------------------------------- 392 ## Tabs 393 --------------------------------------------------------------*/ 394 395 function tabs() { 396 $('.tb-tabs.tb-standard-tabs .tb-tab-links a').on('click', function(e) { 397 var currentAttrValue = $(this).attr('href'); 398 $('.tb-tabs ' + currentAttrValue).show().siblings().hide(); 399 $(this).parent('li').addClass('active').siblings().removeClass('active'); 400 e.preventDefault(); 401 }); 402 $('.tb-tabs.tb-fade-tabs .tb-tab-links a').on('click', function(e) { 403 var currentAttrValue = $(this).attr('href'); 404 $('.tb-tabs ' + currentAttrValue).fadeIn(400).siblings().hide(); 405 $(this).parents('li').addClass('active').siblings().removeClass('active'); 406 e.preventDefault(); 407 }); 408 } 409 410 411 /*-------------------------------------------------------------- 412 ## Custom Modal 413 --------------------------------------------------------------*/ 414 415 function modal() { 416 $('[data-modal-toggle]').on('click', function() { 417 var modalToggle = $(this).data('modal-toggle'); 418 $('.tb-modal').each(function() { 419 var modaltarget = $(this).attr('id'), 420 modalId = ('#' + modaltarget); 421 if (modalToggle == modalId) { 422 $(modalId).addClass('tb-active'); 423 } 424 }); 425 }); 426 // Modal Dismiss Button 427 $('.tb-modal-dismiss').on('click', function() { 428 $(this).parents('.tb-modal').removeClass('tb-active') 429 }); 430 $(document).on('click', function() { 431 $('.tb-modal').removeClass('tb-active'); 432 }); 433 $('.tb-modal > div, [data-modal-toggle]').on('click', function(e) { 434 e.stopPropagation(); 435 }); 436 } 437 438 439 /*-------------------------------------------------------------- 440 ## Custom Select 441 --------------------------------------------------------------*/ 442 443 function customSelectSetup() { 444 $('.tb-custom-select').each(function() { 445 var classes = $(this).attr('class'), 446 id = $(this).attr('id'), 447 name = $(this).attr('name'); 448 var template = '<div class="' + classes + '">'; 449 template += '<span class="custom-select-trigger">' + $('.tb-custom-select-wrap > .tb-custom-select option:first').html() + '</span>'; 450 template += '<div class="custom-options">'; 451 $(this).find('option').each(function() { 452 template += '<span class="custom-option ' + $(this).attr('class') + ' data-value=' + $(this).attr('value') + '">' + $(this).html() + '</span>'; 453 }); 454 template += '</div></div>'; 455 456 $(this).wrap('<div class="custom-select-wrapper"></div>'); 457 $(this).hide(); 458 $(this).after(template); 459 }); 460 $('.custom-select-trigger').on('click', function(event) { 461 $('html').one('click', function() { 462 $('.tb-custom-select').removeClass('opened'); 463 }); 464 $(this).parents('.tb-custom-select').toggleClass('opened'); 465 event.stopPropagation(); 466 }); 467 $('.custom-option').on('click', function() { 468 $(this).parents('.custom-select-wrapper').find('select').val($(this).data('value')); 469 // $(this).parents('.custom-options').find('.tb-custom-option').removeClass('selection'); 470 $(this).siblings().removeClass('selection'); 471 $(this).addClass('selection'); 472 $(this).parent().children().first().removeClass('selection'); 473 $(this).parents('.custom-select').removeClass('opened'); 474 $(this).parent().siblings('.custom-select-trigger').addClass('selector-focus'); 475 $(this).parents('.tb-custom-select').find('.custom-select-trigger').text($(this).text()); 476 }); 477 $('.custom-options .custom-option:first-child').on('click', function() { 478 $(this).parent().siblings('.custom-select-trigger').removeClass('selector-focus'); 479 }); 480 } 481 482 483 /*-------------------------------------------------------------- 484 ## Color Customizer 485 --------------------------------------------------------------*/ 486 487 function lightGallery() { 488 $('.tb-lightgallery').each(function() { 489 $(this).lightGallery({ 490 selector: '.tb-lightbox-item', 491 subHtmlSelectorRelative: true, 492 }); 493 }); 494 } 495 496 497 /*-------------------------------------------------------------- 498 ## Horizontal Progress Bar 499 --------------------------------------------------------------*/ 500 501 function horizontalProgressBar() { 502 $(".tb-single-bar").each(function() { 503 var progressPercentage = $(this).data("progress-percentage") + "%"; 504 $(this).find(".tb-single-bar-in").css("width", progressPercentage); 505 }); 506 507 $('.tb-single-bar').each(function() { 508 509 var windowScroll = $(document).scrollTop(), 510 windowHeight = $(window).height(), 511 barOffset = $(this).offset().top, 512 barHeight = $(this).height(), 513 barScrollUp = barOffset <= (windowScroll + windowHeight),
514 barSctollDown = barOffset + barHeight >= windowScroll; 515 516 if (barSctollDown && barScrollUp) { 517 $(this).addClass('tb-active'); 518 } 519 }); 520 } 521 522 523 /*-------------------------------------------------------------- 524 ## Custom Quantity Calculator 525 --------------------------------------------------------------*/ 526 527 function customQuantity() { 528 $('.tb-quantity-minus').on('click', function() { 529 var $input = $(this).parent().find('input'); 530 if ($input.val() == '') { 531 $input.val(0); 532 } 533 var count = parseInt($input.val()) - 1; 534 count = count <= 0 ? 0 : count; 535 $input.val(count); 536 $input.change(); 537 return false; 538 }); 539 540 $('.tb-quantity-plus').on('click', function() { 541 var $input = $(this).parent().find('input'); 542 if ($input.val() == '') { 543 $input.val(0); 544 } 545 $input.val(parseInt($input.val()) + 1); 546 $input.change(); 547 return false; 548 }); 549 } 550 551 /*-------------------------------------------------------------- 552 ## Line Chart 553 --------------------------------------------------------------*/ 554 555 function lineChart() { 556 557 if ($.exists('#tb-chart2')) { 558 559 var selector = $('.tb-line-chart'), 560 el = selector.data('values'), 561 labels = $.parseJSON(el.view_labels), 562 data = $.parseJSON(el.view_data), 563 y_axis_label = selector.data('y-label'), 564 bg_color = selector.data('bg-color'), 565 border_color = selector.data('border-color'); 566 567 var ctx = document.getElementById('tb-chart2').getContext('2d'); 568 var myChart = new Chart(ctx, { 569 type: 'line', 570 data: { 571 labels: labels, 572 datasets: [{ 573 label: y_axis_label, 574 data: data, 575 backgroundColor: bg_color, 576 borderColor: border_color, 577 borderWidth: 2, 578 lineTension: 0,
579 pointBackgroundColor: '#fff' 580 }] 581 582 }, 583 options: { 584 responsive: true, 585 maintainAspectRatio: false, 586 legend: { 587 position: 'bottom', 588 display: false 589 }, 590 tooltips: { 591 displayColors: false, 592 mode: 'nearest', 593 intersect: false, 594 position: 'nearest', 595 xPadding: 8, 596 yPadding: 8, 597 caretPadding: 8, 598 backgroundColor: '#666666', 599 cornerRadius: 2, 600 titleFontSize: 13, 601 titleFontStyle: 'normal', 602 titleFontFamily: 'Open Sans', 603 bodyFontSize: 13, 604 footerFontFamily: 'Open Sans' 605 }, 606 scales: { 607 yAxes: [{ 608 ticks: { 609 fontSize: 14, 610 fontColor: '#b5b5b5', 611 fontFamily: 'Open Sans', 612 padding: 15, 613 beginAtZero: true, 614 autoSkip: false, 615 maxTicksLimit: 4 616 }, 617 gridLines: { 618 color: '#d8d8d8', 619 borderDash: [1, 3], 620 zeroLineWidth: 1, 621 zeroLineColor: '#eaeaea', 622 drawBorder: false 623 } 624 }], 625 xAxes: [{ 626 ticks: { 627 fontSize: 14, 628 fontColor: '#b5b5b5', 629 fontFamily: 'Open Sans', 630 padding: 5, 631 beginAtZero: true, 632 autoSkip: false, 633 maxTicksLimit: 4 634 }, 635 gridLines: { 636 color: '#d8d8d8', 637 borderDash: [1, 3], 638 zeroLineColor: '#b5b5b5', 639 } 640 }], 641 }, 642 elements: { 643 point: { 644 radius: 3, 645 hoverRadius: 3 646 } 647 } 648 } 649 }); 650 } 651 } 652 653 654 /*-------------------------------------------------------------- 655 ## Round Chart 656 --------------------------------------------------------------*/ 657 658 function roundChart() { 659 if ($.exists('.tb-round-chart')) { 660 661 $('.tb-round-chart').each(function() { 662 var ctx = $(this).find('#tb-chart1'), 663 el = $(this), 664 options = el.data('options'), 665 labels = {}, 666 values = [], 667 stroke_colors = []; 668 669 $.each(options, function(key, value) { 670 labels[key] = value['label']; 671 values[key] = parseInt(value['value']); 672 stroke_colors[key] = value['stroke_color']; 673 el.find('.tb-circle-stroke .tb-circle-label').eq(key).html(value['label']).siblings().css('background-color', value['stroke_color']); 674 }); 675 676 var myChart = new Chart(ctx, { 677 type: 'pie', 678 data: { 679 labels: labels, 680 datasets: [{ 681 backgroundColor: stroke_colors, 682 data: values, 683 borderWidth: 0 684 }] 685 }, 686 options: { 687 cutoutPercentage: 80, 688 legend: { 689 position: 'right', 690 display: false 691 }, 692 tooltips: { 693 displayColors: false, 694 mode: 'nearest', 695 intersect: false, 696 position: 'nearest', 697 xPadding: 8, 698 yPadding: 8, 699 caretPadding: 8, 700 backgroundColor: '#666666', 701 cornerRadius: 2, 702 titleFontSize: 13, 703 titleFontStyle: 'normal', 704 titleFontFamily: 'Open Sans', 705 bodyFontSize: 13, 706 footerFontFamily: 'Open Sans' 707 }, 708 } 709 }); 710 711 }); 712 } 713 } 714 715 716 /*-------------------------------------------------------------- 717 ## CountDown 718 --------------------------------------------------------------*/ 719 720 function countDown() { 721 if ($.exists('.tb-countdown')) { 722 $('.tb-countdown').each(function() { 723 var _this = this; 724 var el = $(_this).data('countdate'); 725 var countDownDate = new Date(el).getTime(); 726 var x = setInterval(function() { 727 var now = new Date().getTime(); 728 var distance = countDownDate - now; 729 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 730 var hours = Math.floor(distance % (1000 * 60 * 60 * 24) / (1000 * 60 * 60)); 731 var minutes = Math.floor(distance % (1000 * 60 * 60) / (1000 * 60)); 732 var seconds = Math.floor(distance % (1000 * 60) / 1000); 733 $(_this).find('#tb-count-days').html(days); 734 $(_this).find('#tb-count-hours').html(hours); 735 $(_this).find('#tb-count-minutes').html(minutes); 736 $(_this).find('#tb-count-seconds').html(seconds); 737 738 if (distance < 0) { 739 clearInterval(x); 740 $(_this).html("TOKEN EXPIRED"); 741 } 742 }, 1000); 743 }); 744 } 745 } 746 747 748 /*-------------------------------------------------------------- 749 ## Section Scroll 750 --------------------------------------------------------------*/ 751 752 function sectionScroll() { 753 if ($.exists('.tb-scroll-section')) { 754 var totalScrollSection = $('.tb-scroll-section').length; 755 var scrollBarHeight = (100 / totalScrollSection) + '%'; 756 $('.tb-scroll-vertical-bar span').css('height', scrollBarHeight); 757 $('.tb-scroll-number-total').text(totalScrollSection); 758 $('.tb-scroll-section').eq(0).addClass('active'); 759 $.scrollify({ 760 section: ".tb-scroll-section", 761 sectionName: false, 762 interstitialSection: ".tb-site-footer.tb-style1", 763 scrollSpeed: 1200, 764 before: function(index, sections) { 765 766 $('.tb-scroll-number-present').text(index + 1); 767 scrollBarHeight = ((100 / totalScrollSection) * (index + 1)) + '%'; 768 $('.tb-scroll-vertical-bar span').css('height', scrollBarHeight); 769 $('.tb-scroll-section').removeClass('active'); 770 $('.tb-scroll-section').eq(index).addClass('active'); 771 772 } 773 774 }); 775 776 $('.tb-scroll-down-btn').on('click', function(e) { 777 e.preventDefault(); 778 $.scrollify.next(); 779 }); 780 781 $('.tb-scroll-up-btn').on('click', function(e) { 782 e.preventDefault(); 783 $.scrollify.previous(); 784 }); 785 786 if ($.exists('.tb-site-header')) { 787 var thisHeight = $('.tb-site-header').height() + 'px'; 788 } 789 } 790 } 791 792 793 /*-------------------------------------------------------------- 794 ## SVG Shape 795 --------------------------------------------------------------*/ 796 797 function tbSvgShape() {
798 if ($.exists('.tb-svg-shape')) { 799 var tbDomSvg = {}; 800 tbDomSvg.svg = document.querySelector('.tb-svg-shape'); 801 tbDomSvg.shapeEl = tbDomSvg.svg.querySelector('path'); 802 803 var shapes = [{ 804 path: 'M 262.9,252.2 C 210.1,338.2 212.6,487.6 288.8,553.9 372.2,626.5 511.2,517.8 620.3,536.3 750.6,558.4 860.3,723 987.3,686.5 1089,657.3 1168,534.7 1173,429.2 1178,313.7 1096,189.1 995.1,130.7 852.1,47.07 658.8,78.95 498.1,119.2 410.7,141.1 322.6,154.8 262.9,252.2 Z', 805 pathAlt: 'M 262.9,252.2 C 210.1,338.2 273.3,400.5 298.5,520 323.7,639.6 511.2,537.2 620.3,555.7 750.6,577.8 872.2,707.4 987.3,686.5 1102,665.6 1218,547.8 1173,429.2 1128,310.6 1096,189.1 995.1,130.7 852.1,47.07 658.8,78.95 498.1,119.2 410.7,141.1 322.6,154.8 262.9,252.2 Z', 806 scaleX: 1.3, 807 scaleY: 1.8, 808 rotate: 70, 809 tx: 0, 810 ty: -100, 811 animation: { 812 path: { 813 duration: 1000, 814 easing: 'easeInOutQuad' 815 } 816 } 817 }]; 818 var step; 819 820 var initShapeLoop = function(pos) { 821 pos = pos || 0; 822 anime.remove(tbDomSvg.shapeEl); 823 anime({ 824 targets: tbDomSvg.shapeEl, 825 easing: 'linear', 826 d: [{ value: shapes[pos].pathAlt, duration: 1500 }, { value: shapes[pos].path, duration: 1500 }], 827 loop: true, 828 direction: 'alternate' 829 }); 830 }; 831 832 var initShapeEl = function() { 833 anime.remove(tbDomSvg.svg); 834 anime({ 835 targets: tbDomSvg.svg, 836 duration: 1, 837 easing: 'linear', 838 scaleX: shapes[0].scaleX, 839 scaleY: shapes[0].scaleY, 840 translateX: shapes[0].tx + 'px', 841 translateY: shapes[0].ty + 'px', 842 rotate: shapes[0].rotate + 'deg' 843 }); 844 845 initShapeLoop(); 846 }; 847 848 initShapeEl(); 849 } 850 } 851 852 853 /*-------------------------------------------------------------- 854 ## Apple TV Effect 855 --------------------------------------------------------------*/ 856 857 function appleTVeffect() { 858 $(document).on('mousemove', '.tb-hover-layer', function(event) { 859 860 var halfW = (this.clientWidth / 2); 861 var halfH = (this.clientHeight / 2); 862 863 var coorX = (halfW - (event.pageX - $(this).offset().left)); 864 var coorY = (halfH - (event.pageY - $(this).offset().top)); 865 866 var degX = ((coorY / halfH) * 8) + 'deg'; // max. degree = 10 867 var degY = ((coorX / halfW) * -8) + 'deg'; // max. degree = 10 868 869 $(this).css('transform', function() { 870 return 'perspective( 600px ) translate3d( 0, -2px, 0 ) rotateX(' + degX + ') rotateY(' + degY + ')'; 871 }) 872 .find('.tb-hover-layer1').css('transform', function() { 873 return 'perspective( 600px ) translate3d( 0, 0, 0 ) rotateX(' + degX + ') rotateY(' + degY + ')'; 874 }); 875 }) 876 .on('mouseout', '.tb-hover-layer', function() { 877 $(this).removeAttr('style').find('.tb-hover-layer1').removeAttr('style'); 878 }); 879 } 880 881 882 /*-------------------------------------------------------------- 883 ## Before After Slider 884 --------------------------------------------------------------*/ 885 886 function beforeAfterSlider() { 887 if ($.exists('.tb-before-after')) { 888 var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; 889 $('.tb-before-after').each(function() { 890 var $container = $(this), 891 $before = $container.find('.tb-before'), 892 $after = $container.find('.tb-after'), 893 $handle = $container.find('.tb-handle-before-after'); 894 895 var maxX = $container.outerWidth(), 896 offsetX = $container.offset().left, 897 startX = 0; 898 899 var touchstart, touchmove, touchend; 900 var mousemove = function(e) { 901 e.preventDefault(); 902 var curX = e.clientX - offsetX, 903 diff = startX - curX, 904 curPos = (curX / maxX) * 100; 905 if (curPos > 100) { 906 curPos = 100; 907 } 908 if (curPos < 0) { 909 curPos = 0; 910 } 911 $before.css({ right: (100 - curPos) + "%" }); 912 $handle.css({ left: curPos + "%" }); 913 }; 914 var mouseup = function(e) { 915 e.preventDefault(); 916 if (supportsTouch) { 917 $(document).off('touchmove', touchmove); 918 $(document).off('touchend', touchend); 919 } else { 920 $(document).off('mousemove', mousemove); 921 $(document).off('mouseup', mouseup); 922 } 923 }; 924 var mousedown = function(e) { 925 e.preventDefault(); 926 startX = e.clientX - offsetX; 927 if (supportsTouch) { 928 $(document).on('touchmove', touchmove); 929 $(document).on('touchend', touchend); 930 } else { 931 $(document).on('mousemove', mousemove); 932 $(document).on('mouseup', mouseup); 933 } 934 }; 935 936 touchstart = function(e) { 937 console.log(e); 938 mousedown({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX }); 939 }; 940 touchmove = function(e) { 941 mousemove({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX }); 942 }; 943 touchend = function(e) { 944 mouseup({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX }); 945 }; 946 if (supportsTouch) { 947 $handle.on('touchstart', touchstart); 948 } else { 949 $handle.on('mousedown', mousedown); 950 } 951 }); 952 } 953 } 954 955 956 /*-------------------------------------------------------------- 957 ## Post Vote Count 958 --------------------------------------------------------------*/ 959 960 function postVoteCount() { 961 $('.tb-vote-btn').each(function() { 962 $(this).on('click', function(e) { 963 e.preventDefault(); 964 965 var parent = $(this).parent('.tb-votes'), 966 post_id = parent.data('post-id'), 967 count = parent.find('.tb-count-no'), 968 $this = $(this), 969 flag; 970 971 if ($this.hasClass('voted')) { 972 alert('Already Voted'); 973 return false;
974 } else if ($this.hasClass('tb-up-vote-btn')) { 975 flag = 'true'; 976 count.text(parseInt(count.text()) + 1); 977 $this.addClass('up-voted voted'); 978 $this.siblings('.tb-down-vote-btn').removeClass('voted'); 979 } else { 980 flag = 'false'; 981 count.text(parseInt(count.text()) - 1); 982 $this.addClass('down-voted voted'); 983 $this.siblings('.tb-up-vote-btn').removeClass('voted'); 984 } 985 986 $.ajax({ 987 type: 'POST', 988 url: get.ajaxurl, 989 data: ({ action: 'post-vote', is_up: flag, id: post_id, vote_nonce: get.nonce }), 990 }); 991 992 }); 993 }); 994 } 995 996 997 /*-------------------------------------------------------------- 998 ## Google Map 999 --------------------------------------------------------------*/ 1000 1001 function googleMap() { 1002 if ($('#map').length > 0) { 1003 var el = $('.tb-map-wrap'), 1004 lat = el.data('lat'), 1005 lng = el.data('lng'), 1006 zoom = el.data('zoom'), 1007 marker = el.data('marker'), 1008 marker_url = (!marker || marker.length === 0) ? get.siteurl + '/assets/img/map-marker.png' : marker; 1009 el.each(function() { 1010 var contactmap = { 1011 lat: lat, 1012 lng: lng 1013 }; 1014 el.find('#map').gmap3({ 1015 zoom: zoom, 1016 center: contactmap, 1017 scrollwheel: false, 1018 1019 }) 1020 .marker({ 1021 position: contactmap, 1022 icon: marker_url 1023 }) 1024 }); 1025 } 1026 } 1027 1028 function qtyStepper() { 1029 if (typeof $.fn.number != 'function') { 1030 return; 1031 } 1032 1033 if ($('input[type=number]').length) { 1034 $('input[type=number]').number(); 1035 }; 1036 } 1037 /*-------------------------------------------------------------- 1038 ## Youtube Playlist 1039 --------------------------------------------------------------*/ 1040 function youtubePlaylist() { 1041 if ($('.yt-playlist').length) { 1042 var wrapper = $('#frame'); 1043 var channelId = wrapper.data('channel-id'); 1044 var ytp = new YTV('frame', { 1045 channelId: channelId, 1046 playerTheme: 'dark', 1047 responsive: true 1048 }); 1049 } 1050 } 1051 1052 /*-------------------------------------------------------------- 1053 ## Ajax Pagination 1054 --------------------------------------------------------------*/ 1055 function ajaxPagination() { 1056 $('.tb-ajax-load-more').each(function() { 1057 1058 var $this = $(this), 1059 $container = $this.parent().find('.tb-post-outerwrapper'), 1060 token = $this.data('token'), 1061 settings = window['webify_load_more_' + token], 1062 is_isotope = parseInt(settings.isotope), 1063 paging = 1, 1064 flood = false, 1065 ajax_data; 1066 1067 $this.bind('click', function() { 1068 1069 if (flood === false) { 1070 paging++; 1071 flood = true; 1072 1073 // set ajax data 1074 ajax_data = $.extend({}, { action: 'ajax-pagination', paged: paging }, settings); 1075 1076 $.ajax({ 1077 type: 'POST', 1078 url: get.ajaxurl, 1079 data: ajax_data, 1080 dataType: 'html', 1081 beforeSend: function() { 1082 $this.addClass('more-loading'); 1083 $this.html('Loading...'); 1084 }, 1085 success: function(html) { 1086 1087 var content = $(html).css('opacity', 0); 1088 1089 if (is_isotope) { 1090 content.imagesLoaded(function() { 1091 $container.append(content).isotope('appended', content); 1092 $container.isotope('layout'); 1093 }); 1094 } else { 1095 $(content).insertBefore($this.parent()); 1096 } 1097 content.animate({ 'opacity': 1 }, 250); 1098 1099 1100 // load button affecting after images loaded 1101 $this.removeClass('more-loading'); 1102 $this.html('Load More'); 1103 if (parseInt(settings.max_pages) == paging) { $this.hide(); } 1104 1105 flood = false; 1106 } 1107 1108 }); 1109 1110 } 1111 1112 return false; 1113 }); 1114 1115 }); 1116 } 1117 1118 /*-------------------------------------------------------------- 1119 ## One page Navigation 1120 --------------------------------------------------------------*/ 1121 1122 function onePage() { 1123 1124 $('.tb-site-header a').on('click', function() { 1125 var thisAttr = $(this).attr('href'); 1126 if ($(thisAttr).length) { 1127 var scrollPoint = $(thisAttr).offset().top - 120; 1128 $('body,html').animate({ 1129 scrollTop: scrollPoint 1130 }, 600); 1131 } 1132 return false;
1133 }); 1134 1135 } 1136 1137 /*-------------------------------------------------------------- 1138 ## Food Menu List 1139 --------------------------------------------------------------*/ 1140 1141 function foodMenuList() { 1142 // Food Menu Custom Isotope 1143 $('.tb-food-list').addClass('tb-food-list-isotope'); 1144 var isotopeActiveClass = $('.tb-food-menu-wrap .active').children('a').data('filter'); 1145 $(isotopeActiveClass).addClass('tb-show-isotope-item'); 1146 $('.tb-food-menu a').on('click', function() { 1147 $(this).parents('.tb-food-menu-wrap').find('.tb-food-list').removeClass('tb-food-list-isotope') 1148 }) 1149 } 1150 1151 /*-------------------------------------------------------------- 1152 ## Parallx 1153 --------------------------------------------------------------*/ 1154 1155 function parallax() { 1156 if ($.exists('.tb-parallax')) { 1157 var numItems = $('.tb-parallax').length; 1158 for (var loopI = 0; loopI < numItems; loopI++) { 1159 $('body').find('.tb-parallax').eq(loopI).addClass('tb-parallax' + loopI); 1160 var speed = $('.tb-parallax' + loopI).data('speed'); 1161 $('.tb-parallax' + loopI).parallax('50%', speed); 1162 } 1163 } 1164 } 1165 1166 /*-------------------------------------------------------------- 1167 ## Modal Search 1168 --------------------------------------------------------------*/ 1169 1170 function searchModal() { 1171 $('.tb-search-modal-btn').on('click', function() { 1172 $('.tb-search-modal').toggleClass('tb-active'); 1173 }) 1174 $('.tb-search-modal-cross, .tb-search-modal-overlay').on('click', function() { 1175 $('.tb-search-modal').removeClass('tb-active'); 1176 }) 1177 } 1178 1179 /*-------------------------------------------------------------- 1180 ## Audio Player 1181 --------------------------------------------------------------*/ 1182 1183 function audioPlayerSetup() { 1184 if ($.exists('.tb-audio-player')) { 1185 $('.tb-audio-player').audioPlayer(); 1186 } 1187 } 1188 1189 /*-------------------------------------------------------------- 1190 ## Zoom Effect 1191 --------------------------------------------------------------*/ 1192 1193 function zoomEffect() { 1194 if ($.exists('.tb-product-zoom')) { 1195 $('.tb-product-zoom').zoom(); 1196 } 1197 } 1198 1199 /*-------------------------------------------------------------- 1200 ## Date Picker 1201 --------------------------------------------------------------*/ 1202 1203 function datePickerSetup() { 1204 if ($.exists('.tb-cs-date')) { 1205 $('.tb-cs-date').datepicker(); 1206 } 1207 } 1208 1209 /*-------------------------------------------------------------- 1210 ## Date Picker 1211 --------------------------------------------------------------*/ 1212 1213 function cursorPlus() { 1214 1215 $('.tb-image-box.tb-style2 a, .tb-horizontal-scroll-item a').each(function() { 1216 $(this).append('<div class="tb-cursor"></div>'); 1217 $(this).on('mousemove', function(ev) { 1218 var cursorOffsetY = $(this).offset().top; 1219 var cursorOffsetX = $(this).offset().left; 1220 var mouseLeft = (ev.pageX - cursorOffsetX - 22) + 'px'; 1221 var mouseRight = (ev.pageY - cursorOffsetY - 22) + 'px'; 1222 $(this).find('.tb-cursor').css({ 'left': mouseLeft, 'top': mouseRight }); 1223 }); 1224 }); 1225 1226 } 1227 1228 1229 /*-------------------------------------------------------------- 1230 ## Elementor Initialize 1231 --------------------------------------------------------------*/ 1232 1233 $(window).on('elementor/frontend/init', function() { 1234 1235 elementorFrontend.hooks.addAction('init', function() { 1236 console.log(this.getSettings('selectors.container')); 1237 }); 1238 1239 elementorFrontend.hooks.addAction('frontend/element_ready/webify-portfolio-widget.default', function($scope, $) { 1240 isotopMsSetup(); 1241 }); 1242 elementorFrontend.hooks.addAction('frontend/element_ready/webify-image-gallery-widget.default', function($scope, $) { 1243 isotopMsSetup(); 1244 }); 1245 elementorFrontend.hooks.addAction('frontend/element_ready/webify-menu-widget.default', function($scope, $) { 1246 isotopMsSetup(); 1247 }); 1248 elementorFrontend.hooks.addAction('frontend/element_ready/webify-blog-widget.default', function($scope, $) { 1249 var selector = $scope.find('.tb-blog-content'); 1250 selector.imagesLoaded(function() { 1251 isotopMsSetup(); 1252 }); 1253 }); 1254 elementorFrontend.hooks.addAction('frontend/element_ready/webify-client-widget.default', function($scope, $) { 1255 swiperSlider(); 1256 }); 1257 elementorFrontend.hooks.addAction('frontend/element_ready/webify-hero-slider-widget.default', function($scope, $) { 1258 swiperSlider(); 1259 }); 1260 elementorFrontend.hooks.addAction('frontend/element_ready/webify-road-map-widget.default', function($scope, $) { 1261 swiperSlider(); 1262 }); 1263 elementorFrontend.hooks.addAction('frontend/element_ready/webify-text-block-with-gallery-widget.default', function($scope, $) { 1264 swiperSlider(); 1265 }); 1266 elementorFrontend.hooks.addAction('frontend/element_ready/webify-road-map-widget.default', function($scope, $) { 1267 swiperSlider(); 1268 }); 1269 elementorFrontend.hooks.addAction('frontend/element_ready/webify-product-slider-widget.default', function($scope, $) { 1270 swiperSlider(); 1271 }); 1272 elementorFrontend.hooks.addAction('frontend/element_ready/webify-icon-box-slider-widget.default', function($scope, $) { 1273 swiperSlider(); 1274 }); 1275 elementorFrontend.hooks.addAction('frontend/element_ready/webify-portfolio-slider-widget.default', function($scope, $) { 1276 swiperSlider(); 1277 }); 1278 elementorFrontend.hooks.addAction('frontend/element_ready/webify-accordion-widget.default', function($scope, $) { 1279 accordianSetup(); 1280 }); 1281 elementorFrontend.hooks.addAction('frontend/element_ready/webify-line-chart-widget.default', function($scope, $) { 1282 lineChart(); 1283 }); 1284 elementorFrontend.hooks.addAction('frontend/element_ready/webify-round-chart-widget.default', function($scope, $) { 1285 roundChart(); 1286 }); 1287 elementorFrontend.hooks.addAction('frontend/element_ready/webify-count-down-widget.default', function($scope, $) { 1288 //Countdown(); 1289 }); 1290 elementorFrontend.hooks.addAction('frontend/element_ready/webify-testimonial-slider-widget.default', function($scope, $) { 1291 swiperSlider(); 1292 }); 1293 elementorFrontend.hooks.addAction('frontend/element_ready/webify-team-slider-widget.default', function($scope, $) { 1294 swiperSlider(); 1295 }); 1296 elementorFrontend.hooks.addAction('frontend/element_ready/webify-image-box-slider-widget.default', function($scope, $) { 1297 swiperSlider(); 1298 }); 1299 elementorFrontend.hooks.addAction('frontend/element_ready/webify-image-gallery-slider-widget.default', function($scope, $) { 1300 swiperSlider(); 1301 }); 1302 elementorFrontend.hooks.addAction('frontend/element_ready/webify-fancy-box-slider-widget.default', function($scope, $) { 1303 swiperSlider(); 1304 }); 1305 elementorFrontend.hooks.addAction('frontend/element_ready/webify-award-widget.default', function($scope, $) { 1306 swiperSlider(); 1307 }); 1308 elementorFrontend.hooks.addAction('frontend/element_ready/webify-blog-slider-widget.default', function($scope, $) { 1309 swiperSlider(); 1310 }); 1311 elementorFrontend.hooks.addAction('frontend/element_ready/webify-progress-bar-widget.default', function($scope, $) { 1312 horizontalProgressBar(); 1313 }); 1314 elementorFrontend.hooks.addAction('frontend/element_ready/webify-google-map-widget.default', function($scope, $) { 1315 googleMap(); 1316 }); 1317 elementorFrontend.hooks.addAction('frontend/element_ready/webify-portfolio-section-scroll-widget.default', function($scope, $) { 1318 sectionScroll(); 1319 }); 1320 elementorFrontend.hooks.addAction('frontend/element_ready/webify-tabs-widget.default', function($scope, $) { 1321 tabs(); 1322 }); 1323 elementorFrontend.hooks.addAction('frontend/element_ready/webify-youtube-video-playlist-widget.default', function($scope, $) { 1324 youtubePlaylist(); 1325 }); 1326 1327 }); 1328 1329 1330 1331})(jQuery); // End of use strict
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.