1; (function ($) { 2 3 "use strict"; 4 5 var pxl_scroll_top; 6 var pxl_window_height; 7 var pxl_window_width; 8 var pxl_scroll_status = ''; 9 var pxl_last_scroll_top = 0; 10 var pxl_post_slip = false; 11 12 $(window).on('load', function () { 13 setTimeout(function () { 14 $(".pxl-loader").addClass("is-loaded"); 15 }, 60); 16 $('.pxl-swiper-slider, .pxl-header-mobile-elementor').css('opacity', '1'); 17 $('.pxl-gallery-scroll').parents('body').addClass('body-overflow').addClass('body-visible-sm'); 18 pxl_window_width = $(window).width(); 19 pxl_window_height = $(window).height(); 20 herrington_header_sticky(); 21 herrington_header_mobile(); 22 herrington_scroll_to_top(); 23 herrington_footer_fixed(); 24 herrington_shop_quantity(); 25 herrington_submenu_responsive(); 26 herrington_panel_anchor_toggle(); 27 herrington_slider_column_offset(); 28 herrington_height_ct_grid(); 29 herrington_bgr_parallax(); 30 herrington_shop_view_layout(); 31 herrington_menu_divider_move(); 32 herrington_fit_to_screen(); 33 herrington_el_parallax(); 34 }); 35 36 $(window).on('scroll', function () { 37 pxl_scroll_top = $(window).scrollTop(); 38 pxl_window_height = $(window).height(); 39 pxl_window_width = $(window).width(); 40 if (pxl_scroll_top < pxl_last_scroll_top) { 41 pxl_scroll_status = 'up'; 42 } else { 43 pxl_scroll_status = 'down'; 44 } 45 pxl_last_scroll_top = pxl_scroll_top; 46 herrington_header_sticky(); 47 herrington_scroll_to_top(); 48 herrington_footer_fixed(); 49 herrington_ptitle_scroll_opacity(); 50 if (pxl_scroll_top < 100) { 51 $('.elementor > .pin-spacer').removeClass('scroll-top-active'); 52 } 53 }); 54 55 56 $(window).on('resize', function () { 57 pxl_window_height = $(window).height(); 58 pxl_window_width = $(window).width(); 59 herrington_submenu_responsive(); 60 herrington_height_ct_grid(); 61 herrington_header_mobile(); 62 herrington_slider_column_offset(); 63 herrington_fit_to_screen(); 64 setTimeout(function () { 65 herrington_menu_divider_move(); 66 }, 500); 67 }); 68 $(document).ready(function () { 69 herrington_button_parallax(); 70 herrington_text_parallax(); 71 herrington_backtotop_progess_bar(); 72 herrington_bgr_hv(); 73 herrington_type_file_upload(); 74 herrington_zoom_point(); 75 herrington_scroll_checkp_blog(); 76 77 $('.pxl-circle-svg svg').each(function () { 78 var linearGradient = $(this).find('.linear-dot1'); 79 if (linearGradient.length > 0) { 80 var linearGradientId = linearGradient.attr('id'); 81 } 82 var linearGradient1 = $(this).find('.linear-dot2'); 83 if (linearGradient1.length > 0) { 84 var linearGradientId1 = linearGradient1.attr('id'); 85 } 86 herrington_circle_svg(this, linearGradientId, linearGradientId1); 87 }); 88 89 90 $('a[href^="#"]:not(.tabs a)').on('click', function (e) { 91 e.preventDefault(); 92 93 const target = $(this.getAttribute('href')); 94 95 if (target.length) { 96 $('html, body').animate( 97 { 98 scrollTop: target.offset().top, 99 }, 100 600 101 ); 102 } 103 }); 104 /* Login */ 105 $('.pxl-icon--users .icon-user').on('click', function () { 106 if ($(this).parent().hasClass('active')) { 107 $(this).parent().removeClass('active'); 108 } else { 109 $(this).parent().addClass('active'); 110 } 111 }); 112 $('.pxl-icon--users .btn-action').on('click', function () { 113 $(this).parent().addClass('deactive'); 114 }); 115 $('.pxl-icon--users .btn-action.act-login').on('click', function () { 116 $(this).parent().parent().find('.pxl-user-login').removeClass('hide'); 117 $(this).parent().parent().find('.wrap-form-action').removeClass('hide'); 118 }); 119 $('.pxl-icon--users .btn-action.act-register').on('click', function () { 120 $(this).parent().parent().find('.pxl-user-register').removeClass('hide'); 121 $(this).parent().parent().find('.wrap-form-action').removeClass('hide'); 122 }); 123 $('.btn-sign-up').on('click', function () { 124 $(this).parents('.wrap-form-action').find('.pxl-user-register').removeClass('hide'); 125 $(this).parents('.wrap-form-action').find('.pxl-user-login').addClass('hide'); 126 }); 127 $('.btn-sign-in').on('click', function () { 128 $(this).parents('.wrap-form-action').find('.pxl-user-login').removeClass('hide'); 129 $(this).parents('.wrap-form-action').find('.pxl-user-register').addClass('hide'); 130 }); 131 /* Start Menu Mobile */ 132 $('.pxl-header-menu li.menu-item-has-children').append('<span class="pxl-menu-toggle"></span>'); 133 $('.pxl-menu-toggle').on('click', function () { 134 if ($(this).hasClass('active')) { 135 $(this).closest('ul').find('.pxl-menu-toggle.active').toggleClass('active'); 136 $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle(); 137 } else { 138 $(this).closest('ul').find('.pxl-menu-toggle.active').toggleClass('active'); 139 $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle(); 140 $(this).toggleClass('active'); 141 $(this).parent().find('> .sub-menu').toggleClass('active'); 142 $(this).parent().find('> .sub-menu').slideToggle(); 143 } 144 }); 145 146 147 $("#pxl-nav-mobile, .pxl-anchor-mobile-menu").on('click', function () { 148 $(this).toggleClass('active'); 149 $('body').toggleClass('body-overflow'); 150 $('.pxl-header-menu').toggleClass('active'); 151 }); 152 153 $(".pxl-menu-close, .pxl-header-menu-backdrop, #pxl-header-mobile .pxl-menu-primary a.is-one-page, .pxl-nav-vertical .pxl-menu-primary a.is-one-page").on('click', function () { 154 $(this).parents('.pxl-header-main').find('.pxl-header-menu').removeClass('active'); 155 $('#pxl-nav-mobile').removeClass('active'); 156 $('.pxl-hidden-panel-popup').removeClass('active'); 157 $('body').toggleClass('body-overflow'); 158 }); 159 /* End Menu Mobile */ 160 $('.pxl-search-form1 .pxl-search-submit').on('click', function (e) { 161 162 var $btn = $(this); 163 var $form = $btn.closest('.pxl-search-form1'); 164 165 var $select = $form.find('select.pxl-select-hidden'); 166 var $option = $select.find('option:selected'); 167 168 var dataLink = ($option.data('link') || '#').toString().trim(); 169 170 // â CASE 1: data-link != # â Äi thẳng 171 if (dataLink && dataLink !== '#') { 172 e.preventDefault(); 173 window.location.href = dataLink; 174 return; 175 } 176 177 // â CASE 2: data-link = # â giữ logic search cá»§a bạn 178 e.preventDefault(); 179 180 var selectedText = $form.find('.pxl-select-higthlight').text().trim(); 181 var baseUrl = ($btn.attr('href') || '').split('?')[0]; 182 var newUrl = baseUrl + '?s=' + encodeURIComponent(selectedText); 183 184 window.location.href = newUrl; 185 }); 186 187 /* Menu Vertical */ 188 // $('.pxl-nav-vertical li.menu-item-has-children > a').append('<span class="pxl-arrow-toggle"><i class="flaticon-right-up"></i></span>'); 189 // $('.pxl-nav-vertical li.menu-item-has-children > a').on('click', function () { 190 // if( $(this).hasClass('active')){ 191 // $(this).next().toggleClass('active').slideToggle(); 192 // }else{ 193 // $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle(); 194 // $(this).closest('ul').find('a.active').toggleClass('active'); 195 // $(this).find('.pxl-menu-toggle.active').toggleClass('active'); 196 // $(this).toggleClass('active'); 197 // $(this).next().toggleClass('active').slideToggle(); 198 // } 199 // }); 200 201 document.querySelectorAll(".pxl-column-line-yes").forEach((el) => { 202 if (el.dataset.linesAdded === "1") return; 203 el.dataset.linesAdded = "1"; 204 205 for (let i = 1; i <= 3; i++) { 206 const span = document.createElement("span"); 207 span.className = `line-column line-column-${i}`; 208 el.appendChild(span); 209 } 210 }); 211 $(".comments-area .btn-submit").append('<i class="caseicon-comment-solid"></i>'); 212 /* Mega Menu Max Height */ 213 var m_h_mega = $('li.pxl-megamenu > .sub-menu > .pxl-mega-menu-elementor').outerHeight(); 214 var w_h_mega = $(window).height(); 215 var w_h_mega_css = w_h_mega - 120; 216 if (m_h_mega > w_h_mega) { 217 $('li.pxl-megamenu > .sub-menu > .pxl-mega-menu-elementor').css('max-height', w_h_mega_css + 'px'); 218 $('li.pxl-megamenu > .sub-menu > .pxl-mega-menu-elementor').css('overflow-x', 'scroll'); 219 } 220 // Active Mega Menu Hover 221 $('li.pxl-megamenu').hover(function () { 222 $(this).parents('.elementor-section').addClass('section-mega-active'); 223 }, function () { 224 $(this).parents('.elementor-section').removeClass('section-mega-active'); 225 }); 226 /* End Mega Menu Max Height */ 227 //custom form 228 229 /* Search Popup */ 230 var $search_wrap_init = $("#pxl-search-popup"); 231 var search_field = $('#pxl-search-popup .search-field'); 232 var $body = $('body'); 233 234 $(".pxl-search-popup-button").on('click', function (e) { 235 if (!$search_wrap_init.hasClass('active')) { 236 $search_wrap_init.addClass('active'); 237 setTimeout(function () { search_field.get(0).focus(); }, 500); 238 } else if (search_field.val() === '') { 239 $search_wrap_init.removeClass('active'); 240 search_field.get(0).focus(); 241 } 242 e.preventDefault(); 243 return false;
244 }); 245 246 $(".pxl-subscribe-popup .pxl-item--overlay, .pxl-subscribe-popup .pxl-item--close").on('click', function (e) { 247 $(this).parents('.pxl-subscribe-popup').removeClass('pxl-active'); 248 e.preventDefault(); 249 return false; 250 }); 251 252 $("#pxl-search-popup .pxl-item--overlay, #pxl-search-popup .pxl-item--close").on('click', function (e) { 253 $body.addClass('pxl-search-out-anim'); 254 setTimeout(function () { 255 $body.removeClass('pxl-search-out-anim'); 256 }, 800); 257 setTimeout(function () { 258 $search_wrap_init.removeClass('active'); 259 }, 800); 260 e.preventDefault(); 261 return false; 262 }); 263 264 /* Scroll To Top */ 265 $('.pxl-scroll-top').click(function () { 266 $('html, body').animate({ scrollTop: 0 }, 1200); 267 $(this).parents('.pxl-wapper').find('.elementor > .pin-spacer').addClass('scroll-top-active'); 268 return false; 269 }); 270 271 /* Animate Time Delay */ 272 273 274 275 276 $('.pxl-grid-masonry').each(function () { 277 var eltime = 80; 278 var elt_inner = $(this).children().length; 279 var _elt = elt_inner - 1; 280 $(this).find('> .pxl-grid-item > .wow').each(function (index, obj) { 281 $(this).css('animation-delay', eltime + 'ms'); 282 if (_elt === index) { 283 eltime = 80; 284 _elt = _elt + elt_inner; 285 } else { 286 eltime = eltime + 80; 287 } 288 }); 289 }); 290 291 $('.btn-text-nina').each(function () { 292 var eltime = 0.045; 293 var elt_inner = $(this).children().length; 294 var _elt = elt_inner - 1; 295 $(this).find('> .pxl--btn-text > span').each(function (index, obj) { 296 $(this).css('transition-delay', eltime + 's'); 297 eltime = eltime + 0.045; 298 }); 299 }); 300 301 $('.btn-text-nanuk').each(function () { 302 var eltime = 0.05; 303 var elt_inner = $(this).children().length; 304 var _elt = elt_inner - 1; 305 $(this).find('> .pxl--btn-text > span').each(function (index, obj) { 306 $(this).css('animation-delay', eltime + 's'); 307 eltime = eltime + 0.05; 308 }); 309 }); 310 311 $('.btn-text-smoke').each(function () { 312 var eltime = 0.05; 313 var elt_inner = $(this).children().length; 314 var _elt = elt_inner - 1; 315 $(this).find('> .pxl--btn-text > span > span > span').each(function (index, obj) { 316 $(this).css('--d', eltime + 's'); 317 eltime = eltime + 0.05; 318 }); 319 }); 320 321 $('.btn-text-reverse .pxl-text--front, .btn-text-reverse .pxl-text--back').each(function () { 322 var eltime = 0.05; 323 var elt_inner = $(this).children().length; 324 var _elt = elt_inner - 1; 325 $(this).find('.pxl-text--inner > span').each(function (index, obj) { 326 $(this).css('transition-delay', eltime + 's'); 327 eltime = eltime + 0.05; 328 }); 329 }); 330 331 /* End Animate Time Delay */ 332 333 /* Lightbox Popup */ 334 $('.pxl-action-popup').magnificPopup({ 335 type: 'iframe', 336 mainClass: 'mfp-fade', 337 removalDelay: 160, 338 preloader: false, 339 fixedContentPos: false 340 }); 341 342 $('.pxl-gallery-lightbox').each(function () { 343 $(this).magnificPopup({ 344 delegate: 'a.lightbox', 345 type: 'image', 346 gallery: { 347 enabled: true 348 }, 349 mainClass: 'mfp-fade', 350 }); 351 }); 352 353 /* Page Title Parallax */ 354 if ($('#pxl-page-title-default').hasClass('pxl--parallax')) { 355 $(this).stellar(); 356 } 357 358 /* Cart Sidebar Popup */ 359 $(".pxl-cart-sidebar-button").on('click', function () { 360 $('body').addClass('body-overflow'); 361 $('#pxl-cart-sidebar').addClass('active'); 362 }); 363 $("#pxl-cart-sidebar .pxl-popup--overlay, #pxl-cart-sidebar .pxl-item--close").on('click', function () { 364 $('body').removeClass('body-overflow'); 365 $('#pxl-cart-sidebar').removeClass('active'); 366 }); 367 $(".pxl-accordion1.style2 .pxl-accordion--content").find("br").remove(); 368 /* Hover Active Item */ 369 $('.pxl--widget-hover').each(function () { 370 $(this).hover(function () { 371 $(this).parents('.elementor-row').find('.pxl--widget-hover').removeClass('pxl--item-active'); 372 $(this).parents('.elementor-container').find('.pxl--widget-hover').removeClass('pxl--item-active'); 373 $(this).addClass('pxl--item-active'); 374 }); 375 }); 376 /* Hover Active button */ 377 378 /* Start Icon Bounce */ 379 var boxEls = $('.el-bounce, .pxl-image-effect1, .el-effect-zigzag'); 380 $.each(boxEls, function (boxIndex, boxEl) { 381 loopToggleClass(boxEl, 'active'); 382 }); 383 384 function loopToggleClass(el, toggleClass) { 385 el = $(el); 386 let counter = 0; 387 if (el.hasClass(toggleClass)) { 388 waitFor(function () { 389 counter++; 390 return counter == 2; 391 }, function () { 392 counter = 0; 393 el.removeClass(toggleClass); 394 loopToggleClass(el, toggleClass); 395 }, 'Deactivate', 1000); 396 } else { 397 waitFor(function () { 398 counter++; 399 return counter == 3; 400 }, function () { 401 counter = 0; 402 el.addClass(toggleClass); 403 loopToggleClass(el, toggleClass); 404 }, 'Activate', 1000); 405 } 406 } 407 408 function waitFor(condition, callback, message, time) { 409 if (message == null || message == '' || typeof message == 'undefined') { 410 message = 'Timeout'; 411 } 412 if (time == null || time == '' || typeof time == 'undefined') { 413 time = 100; 414 } 415 var cond = condition(); 416 if (cond) { 417 callback(); 418 } else { 419 setTimeout(function () { 420 waitFor(condition, callback, message, time); 421 }, time); 422 } 423 } 424 /* End Icon Bounce */ 425
426 /* Image Effect */ 427 if ($('.pxl-image-tilt').length) { 428 $('.pxl-image-tilt').parents('.elementor-top-section').addClass('pxl-image-tilt-active'); 429 $('.pxl-image-tilt').each(function () { 430 var pxl_maxtilt = $(this).data('maxtilt'), 431 pxl_speedtilt = $(this).data('speedtilt'), 432 pxl_perspectivetilt = $(this).data('perspectivetilt'); 433 VanillaTilt.init(this, { 434 max: pxl_maxtilt, 435 speed: pxl_speedtilt, 436 perspective: pxl_perspectivetilt 437 }); 438 }); 439 } 440 441 /* Select Theme Style */ 442 $('.wpcf7-select').each(function () { 443 var $this = $(this), numberOfOptions = $(this).children('option').length; 444 445 $this.addClass('pxl-select-hidden'); 446 $this.wrap('<div class="pxl-select"></div>'); 447 $this.after('<div class="pxl-select-higthlight"></div>'); 448 449 var $styledSelect = $this.next('div.pxl-select-higthlight'); 450 $styledSelect.text($this.children('option').eq(0).text()); 451 452 var $list = $('<ul />', { 453 'class': 'pxl-select-options' 454 }).insertAfter($styledSelect); 455 456 for (var i = 0; i < numberOfOptions; i++) { 457 $('<li />', { 458 text: $this.children('option').eq(i).text(), 459 rel: $this.children('option').eq(i).val() 460 }).appendTo($list); 461 } 462 463 var $listItems = $list.children('li'); 464 465 $styledSelect.click(function (e) { 466 e.stopPropagation(); 467 $('div.pxl-select-higthlight.active').not(this).each(function () { 468 $(this).removeClass('active').next('ul.pxl-select-options').addClass('pxl-select-lists-hide'); 469 }); 470 $(this).toggleClass('active'); 471 }); 472 473 $listItems.click(function (e) { 474 e.stopPropagation(); 475 $styledSelect.text($(this).text()).removeClass('active'); 476 $this.val($(this).attr('rel')); 477 }); 478 479 $(document).click(function () { 480 $styledSelect.removeClass('active'); 481 }); 482 483 }); 484 485 /* Nice Select */ 486 $('.woocommerce-ordering .orderby, #pxl-sidebar-area select, .variations_form.cart .variations select, .pxl-open-table select, .pxl-nice-select').each(function () { 487 $(this).niceSelect(); 488 }); 489 490 $('.pxl-post-list .nice-select').each(function () { 491 $(this).niceSelect(); 492 }); 493 494 /* Typewriter */ 495 if ($('.pxl-title--typewriter').length) { 496 function typewriterOut(elements, callback) { 497 if (elements.length) { 498 elements.eq(0).addClass('is-active'); 499 elements.eq(0).delay(3000); 500 elements.eq(0).removeClass('is-active'); 501 typewriterOut(elements.slice(1), callback); 502 } 503 else { 504 callback(); 505 } 506 } 507 508 function typewriterIn(elements, callback) { 509 if (elements.length) { 510 elements.eq(0).addClass('is-active'); 511 elements.eq(0).delay(3000).slideDown(3000, function () { 512 elements.eq(0).removeClass('is-active'); 513 typewriterIn(elements.slice(1), callback); 514 }); 515 } 516 else { 517 callback(); 518 } 519 } 520 521 function typewriterInfinite() { 522 typewriterOut($('.pxl-title--typewriter .pxl-item--text'), function () { 523 typewriterIn($('.pxl-title--typewriter .pxl-item--text'), function () { 524 typewriterInfinite(); 525 }); 526 }); 527 } 528 $(function () { 529 typewriterInfinite(); 530 }); 531 } 532 /* End Typewriter */ 533 534 /* Section Particles */ 535 setTimeout(function () { 536 $(".pxl-row-particles").each(function () { 537 particlesJS($(this).attr('id'), { 538 "particles": { 539 "number": { 540 "value": $(this).data('number'), 541 }, 542 "color": { 543 "value": $(this).data('color') 544 }, 545 "shape": { 546 "type": "circle", 547 }, 548 "size": { 549 "value": $(this).data('size'), 550 "random": $(this).data('size-random'), 551 }, 552 "line_linked": { 553 "enable": false, 554 }, 555 "move": { 556 "enable": true, 557 "speed": 2, 558 "direction": $(this).data('move-direction'), 559 "random": true, 560 "out_mode": "out", 561 } 562 }, 563 "retina_detect": true 564 }); 565 }); 566 }, 400); 567 568 //add class scroll image 569 $('.pxl-image-scroll .wrap-image .pxl-item--image').each(function () { 570 if (!$(this).hasClass('active')) { 571 $(this).addClass('active'); 572 return false;
573 } 574 }); 575 $('.pxl-image-scroll .wrap-content .title:first-child').addClass('active'); 576 577 /* Get checked input - Mailchimpp */ 578 $('.mc4wp-form input:checkbox').change(function () { 579 if ($(this).is(":checked")) { 580 $('.mc4wp-form').addClass("pxl-input-checked"); 581 } else { 582 $('.mc4wp-form').removeClass("pxl-input-checked"); 583 } 584 }); 585 586 /* Scroll to content */ 587 $('.pxl-link-to-section .btn').on('click', function (e) { 588 var id_scroll = $(this).attr('href'); 589 var offsetScroll = $('.pxl-header-elementor-sticky').outerHeight(); 590 e.preventDefault(); 591 $("html, body").animate({ scrollTop: $(id_scroll).offset().top - offsetScroll }, 600); 592 }); 593 594 // Hover Item Active 595 $(".pxl-post-modern1 .pxl-post--content .pxl-post--item") 596 .on("mouseenter", function () { 597 $(this).addClass("active"); 598 $(".pxl-post-modern1 .pxl-post--images .pxl-post--featured").removeClass('active'); 599 var selected_item = $(this).find(".pxl-content--inner").attr("data-image"); 600 $(selected_item).addClass('active').removeClass('non-active'); 601 }) 602 .on("mouseleave", function () { 603 $(".pxl-post-modern1 .pxl-post--content .pxl-post--item").removeClass('active'); 604 $(".pxl-post-modern1 .pxl-post--images .pxl-post--featured").removeClass('non-active'); 605 var selected_item = $(this).find(".pxl-content--inner").attr("data-image"); 606 $(selected_item).removeClass('active').addClass('non-active'); 607 } 608 ); 609 610 // Hover Overlay Effect 611 $('.pxl-overlay-shake').mousemove(function (event) { 612 var offset = $(this).offset(); 613 var W = $(this).outerWidth(); 614 var X = (event.pageX - offset.left); 615 var Y = (event.pageY - offset.top); 616 $(this).find('.pxl-overlay--color').css({ 617 'top': + Y + 'px', 618 'left': + X + 'px' 619 }); 620 }); 621 622 //Some Widget Default 623 //$('.widget .cat-item a, .widget_archive li a').append('<span class="pxl-item--divider"></span>'); 624 625 /* Social Button Click */ 626 $('.pxl-social--button').on('click', function () { 627 $(this).toggleClass('active'); 628 }); 629 $(document).on('click', function (e) { 630 if (e.target.className == 'pxl-social--button active') 631 $('.pxl-social--button').removeClass('active'); 632 }); 633 634 // Header Home 2 635 $('#home-2-header').append('<span class="pxl-header-divider1"></span><span class="pxl-header-divider2"></span><span class="pxl-header-divider3"></span><span class="pxl-header-divider4"></span>'); 636 $('#home-2-header-sticky').append('<span class="pxl-header-divider2"></span><span class="pxl-header-divider4"></span>'); 637 638 }); 639 640 $(document).click(function (event) { 641 if (!$(event.target).closest('.pxl-icon--users.active').length) { 642 $('.pxl-icon--users.active').removeClass('active'); 643 } 644 }); 645 jQuery(document).ajaxComplete(function (event, xhr, settings) { 646 herrington_shop_quantity(); 647 herrington_height_ct_grid(); 648 herrington_bgr_hv(); 649 }); 650 651 jQuery(document).on('updated_wc_div', function () { 652 herrington_shop_quantity(); 653 }); 654 655 /* Header Sticky */ 656 function herrington_header_sticky() { 657 if ($('#pxl-header-elementor').hasClass('is-sticky')) { 658 if (pxl_scroll_top > 100) { 659 $('.pxl-header-elementor-sticky.pxl-sticky-stb').addClass('pxl-header-fixed'); 660 $('#pxl-header-mobile').addClass('pxl-header-mobile-fixed'); 661 } else { 662 $('.pxl-header-elementor-sticky.pxl-sticky-stb').removeClass('pxl-header-fixed'); 663 $('#pxl-header-mobile').removeClass('pxl-header-mobile-fixed'); 664 } 665 666 if (pxl_scroll_status == 'up' && pxl_scroll_top > 100) { 667 $('.pxl-header-elementor-sticky.pxl-sticky-stt').addClass('pxl-header-fixed'); 668 } else { 669 $('.pxl-header-elementor-sticky.pxl-sticky-stt').removeClass('pxl-header-fixed'); 670 } 671 } 672 673 $('.pxl-header-elementor-sticky').parents('body').addClass('pxl-header-sticky'); 674 } 675 676 /* Header Mobile */ 677 function herrington_header_mobile() { 678 var h_header_mobile = $('#pxl-header-elementor').outerHeight(); 679 if (pxl_window_width < 1199) { 680 $('#pxl-header-elementor').css('min-height', h_header_mobile + 'px'); 681 } 682 } 683 684 /* Scroll To Top */ 685 function herrington_scroll_to_top() { 686 if (pxl_scroll_top < pxl_window_height) { 687 $('.pxl-scroll-top').addClass('pxl-off').removeClass('pxl-on'); 688 } 689 if (pxl_scroll_top > pxl_window_height) { 690 $('.pxl-scroll-top').addClass('pxl-on').removeClass('pxl-off'); 691 } 692 } 693 694 /* Footer Fixed */ 695 function herrington_footer_fixed() { 696 setTimeout(function () { 697 var h_footer = $('.pxl-footer-fixed #pxl-footer-elementor').outerHeight() - 1; 698 $('.pxl-footer-fixed #pxl-main').css('margin-bottom', h_footer + 'px'); 699 }, 600); 700 } 701 702 /* WooComerce Quantity */ 703 function herrington_shop_quantity() { 704 "use strict"; 705 $('#pxl-wapper .quantity').append('<span class="quantity-icon quantity-down pxl-icon--minus"></span><span class="quantity-icon quantity-up pxl-icon--plus"></span>'); 706 $('.quantity-up').on('click', function () { 707 $(this).parents('.quantity').find('input[type="number"]').get(0).stepUp(); 708 $(this).parents('.woocommerce-cart-form').find('.actions .button').removeAttr('disabled'); 709 }); 710 $('.quantity-down').on('click', function () { 711 $(this).parents('.quantity').find('input[type="number"]').get(0).stepDown(); 712 $(this).parents('.woocommerce-cart-form').find('.actions .button').removeAttr('disabled'); 713 }); 714 $('.quantity-icon').on('click', function () { 715 var quantity_number = $(this).parents('.quantity').find('input[type="number"]').val(); 716 var add_to_cart_button = $(this).parents(".product, .woocommerce-product-inner").find(".add_to_cart_button"); 717 add_to_cart_button.attr('data-quantity', quantity_number); 718 add_to_cart_button.attr("href", "?add-to-cart=" + add_to_cart_button.attr("data-product_id") + "&quantity=" + quantity_number); 719 }); 720 $('.woocommerce-cart-form .actions .button').removeAttr('disabled'); 721 } 722 723 /* Menu Responsive Dropdown */ 724 function herrington_submenu_responsive() { 725 var $herrington_menu = $('.pxl-header-elementor-main, .pxl-header-elementor-sticky'); 726 $herrington_menu.find('.pxl-menu-primary li').each(function () { 727 var $herrington_submenu = $(this).find('> ul.sub-menu'); 728 if ($herrington_submenu.length == 1) { 729 if (($herrington_submenu.offset().left + $herrington_submenu.width() + 0) > $(window).width()) { 730 $herrington_submenu.addClass('pxl-sub-reverse'); 731 } 732 } 733 }); 734 } 735 736 function herrington_panel_anchor_toggle() { 737 'use strict'; 738 $(document).on('click', '.pxl-anchor-button', function (e) { 739 e.preventDefault(); 740 e.stopPropagation(); 741 var target = $(this).attr('data-target'); 742 $(target).toggleClass('active'); 743 $('body').addClass('body-overflow'); 744 $('.pxl-popup--conent .wow').addClass('animated').removeClass('aniOut'); 745 $('.pxl-popup--conent .fadeInPopup').removeClass('aniOut'); 746 if ($(target).find('.pxl-search-form').length > 0) { 747 setTimeout(function () { 748 $(target).find('.pxl-search-form .pxl-search-field').focus(); 749 }, 1000); 750 } 751 }); 752 753 $(document).ready(function () { 754 $('.pxl-post-taxonomy .pxl-count').each(function () { 755 var content = $(this).html(); 756 if (content) { // Ensure content is not null or undefined 757 var newContent = content.replace('(', ''); 758 var newContent2 = newContent.replace(')', ''); 759 $(this).html(newContent2); 760 } 761 }); 762 }); 763 764 $(document).on('click', '.pxl-button.pxl-atc-popup > .btn , .pxl-team-grid .pxl-item--image > a, .pxl-team-carousel1 .pxl-item--image > a', function (e) { 765 $('.pxl-page-popup').removeClass('active'); 766 e.preventDefault(); 767 e.stopPropagation(); 768 var target = $(this).attr('data-target'); 769 $(target).toggleClass('active'); 770 $('body').addClass('body-overflow'); 771 }); 772 773 $('.pxl-anchor-button').each(function () { 774 var t_target = $(this).attr('data-target'); 775 var t_delay = $(this).attr('data-delay-hover'); 776 $(t_target).find('.pxl-popup--conent').css('transition-delay', t_delay + 'ms'); 777 $(t_target).find('.pxl-popup--overlay').css('transition-delay', t_delay + 'ms'); 778 }); 779 780 $(".pxl-hidden-panel-popup .pxl-popup--overlay, .pxl-hidden-panel-popup .pxl-close-popup").on('click', function () { 781 $('body').removeClass('body-overflow'); 782 $('.pxl-hidden-panel-popup').removeClass('active'); 783 $('.pxl-popup--conent .wow').addClass('aniOut').removeClass('animated'); 784 $('.pxl-popup--conent .fadeInPopup').addClass('aniOut'); 785 }); 786 787 788 789 790 791 $(".pxl-icon-box6 .btn-show-more").on('click', function () { 792 $(this).parents('.pxl-icon-box6').addClass('active'); 793 $(this).parents('.pxl-icon-box6').find('.content-2').addClass('active'); 794 }); 795 796 797 $(".pxl-popup--close").on('click', function () { 798 $('body').removeClass('body-overflow'); 799 $(this).parent().removeClass('active'); 800 }); 801 $(".pxl-close-popup").on('click', function () { 802 $('body').removeClass('body-overflow'); 803 $('.pxl-page-popup').removeClass('active'); 804 }); 805 } 806 807 /* Page Title Scroll Opacity */ 808 function herrington_ptitle_scroll_opacity() { 809 var divs = $('#pxl-page-title-elementor.pxl-scroll-opacity .elementor-widget'), 810 limit = $('#pxl-page-title-elementor.pxl-scroll-opacity').outerHeight(); 811 if (pxl_scroll_top <= limit) { 812 divs.css({ 'opacity': (1 - pxl_scroll_top / limit) }); 813 } 814 } 815 816 /* Slider Column Offset */ 817 function herrington_slider_column_offset() { 818 var content_w = ($('#pxl-main').width() - 1200) / 2; 819 if (pxl_window_width > 1200) { 820 $('.pxl-slider2 .pxl-item--left').css('padding-left', content_w + 'px'); 821 } 822 } 823 824 /* Preloader Default */ 825 $.fn.extend({ 826 jQueryImagesLoaded: function () { 827 var $imgs = this.find('img[src!=""]') 828 829 if (!$imgs.length) { 830 return $.Deferred() 831 .resolve() 832 .promise() 833 } 834 835 var dfds = [] 836 837 $imgs.each(function () { 838 var dfd = $.Deferred() 839 dfds.push(dfd) 840 var img = new Image() 841 img.onload = function () { 842 dfd.resolve() 843 } 844 img.onerror = function () { 845 dfd.resolve() 846 } 847 img.src = this.src 848 }) 849 850 return $.when.apply($, dfds) 851 } 852 }) 853 854 855 function herrington_circle_svg(element, linearGradientId, linearGradientId1) { 856 if (window.innerWidth <= 1200) return; 857 858 const s = Snap(element); 859 if (!s) return; 860 861 const path = s.select('path'); 862 if (!path) return; 863 864 const len = path.getTotalLength(); 865 const size = 4; 866 const duration = 5000; 867 868 const dot1 = s.circle(0, 0, size).attr({ 869 class: 'dot', 870 fill: 'url(#' + linearGradientId + ')' 871 }); 872 873 874 function setDot(dot, l) { 875 const p = path.getPointAtLength(l); 876 dot.attr({ cx: p.x, cy: p.y }); 877 } 878 879 let startTime = null; 880 881 function tick(timestamp) { 882 if (!startTime) startTime = timestamp;
883 const elapsed = timestamp - startTime; 884 const progress = (elapsed % duration) / (duration * 2); 885 const pos1 = len * progress; 886 setDot(dot1, pos1); 887 888 requestAnimationFrame(tick); 889 } 890 891 requestAnimationFrame(tick); 892 } 893 894 895 /* Button Parallax */ 896 function herrington_button_parallax() { 897 898 $('.btn-text-parallax').on('mousemove', function (e) { 899 const bounds = this.getBoundingClientRect(); 900 const centerX = bounds.left + bounds.width / 2; 901 const centerY = bounds.top + bounds.height; 902 const deltaX = Math.floor((centerX - e.clientX)) * 0.222; 903 const deltaY = Math.floor((centerY - e.clientY)) * 0.333; 904 $(this).find('.pxl--btn-text').css({ 905 transform: 'translate3d(' + deltaX * 0.32 + 'px, ' + deltaY * 0.32 + 'px, 0px)' 906 }); 907 }); 908 } 909 function herrington_bgr_parallax() { 910 setTimeout(function () { 911 jarallax(document.querySelectorAll('.pxl-section-bg-parallax'), { 912 speed: 0.2, 913 }); 914 }, 300); 915 } 916 917 function herrington_el_parallax() { 918 $('.el-parallax-wrap').on({ 919 mouseenter: function () { 920 const $this = $(this); 921 $this.addClass('hovered'); 922 $this.find('.el-parallax-item').css({ 923 transition: 'none' 924 }); 925 }, 926 mouseleave: function () { 927 const $this = $(this); 928 $this.removeClass('hovered'); 929 $this.find('.el-parallax-item').css({ 930 transition: 'transform 0.5s ease', 931 transform: 'translate3d(0px, 0px, 0px)' 932 }); 933 }, 934 mousemove: function (e) { 935 const $this = $(this); 936 const bounds = this.getBoundingClientRect(); 937 const centerX = bounds.left + bounds.width / 2; 938 const centerY = bounds.top + bounds.height / 2; 939 const deltaX = (centerX - e.clientX) * 0.07104; 940 const deltaY = (centerY - e.clientY) * 0.10656; 941 942 requestAnimationFrame(() => { 943 $this.find('.el-parallax-item').css({ 944 transform: `translate3d(${deltaX}px, ${deltaY}px, 0px)` 945 }); 946 }); 947 } 948 }); 949 } 950 951 function herrington_bgr_hv() { 952 $('.pxl-portfolio-carousel2 .pxl-swiper-slide .pxl-post--inner').each(function () { 953 var bg = $(this).css('background-image'); 954 bg = bg.replace('url(', '').replace(')', '').replace(/\"/gi, ""); 955 $('.bgr-change').css('background-image', 'url(' + bg + ')'); 956 $(this).hover(function () { 957 var bg = $(this).css('background-image'); 958 bg = bg.replace('url(', '').replace(')', '').replace(/\"/gi, ""); 959 $('.bgr-change').css('background-image', 'url(' + bg + ')'); 960 $('.bgr-change').addClass('flicker') 961 setTimeout(() => { 962 $('.bgr-change').removeClass('flicker') 963 }, 600) 964 }); 965 }); 966 } 967 /* Menu Divider Move */ 968 function herrington_menu_divider_move() { 969 $('.pxl-nav-menu1.fr-style-box').each(function () { 970 var current = $(this).find('.pxl-menu-primary > .current-menu-item, .pxl-menu-primary > .current-menu-parent, .pxl-menu-primary > .current-menu-ancestor'); 971 if (current.length > 0) { 972 var marker = $(this).find('.pxl-divider-move'); 973 marker.css({ 974 left: current.position().left, 975 width: current.outerWidth(), 976 display: "block" 977 }); 978 marker.addClass('active'); 979 current.addClass('pxl-shape-active'); 980 if (Modernizr.csstransitions) { 981 $(this).find('.pxl-menu-primary > li').mouseover(function () { 982 var self = $(this), 983 offsetLeft = self.position().left, 984 width = self.outerWidth() || current.outerWidth(), 985 left = offsetLeft == 0 ? 0 : offsetLeft || current.position().left; 986 marker.css({ 987 left: left, 988 width: width, 989 }); 990 marker.addClass('active'); 991 current.removeClass('pxl-shape-active'); 992 }); 993 $(this).find('.pxl-menu-primary').mouseleave(function () { 994 marker.css({ 995 left: current.position().left, 996 width: current.outerWidth() 997 }); 998 current.addClass('pxl-shape-active'); 999 }); 1000 } 1001 } else {
1002 var marker = $(this).find('.pxl-divider-move'); 1003 var current = $(this).find('.pxl-menu-primary > li:nth-child(1)'); 1004 marker.css({ 1005 left: current.position().left, 1006 width: current.outerWidth(), 1007 display: "block" 1008 }); 1009 if (Modernizr.csstransitions) { 1010 $(this).find('.pxl-menu-primary > li').mouseover(function () { 1011 var self = $(this), 1012 offsetLeft = self.position().left, 1013 width = self.outerWidth() || current.outerWidth(), 1014 left = offsetLeft == 0 ? 0 : offsetLeft || current.position().left; 1015 marker.css({ 1016 left: left, 1017 width: width, 1018 }); 1019 marker.addClass('active'); 1020 }); 1021 $(this).find('.pxl-menu-primary').mouseleave(function () { 1022 marker.css({ 1023 left: current.position().left, 1024 width: current.outerWidth() 1025 }); 1026 marker.removeClass('active'); 1027 }); 1028 } 1029 } 1030 }); 1031 } 1032 1033 /* Back To Top Progress Bar */ 1034 function herrington_backtotop_progess_bar() { 1035 if ($('.pxl-scroll-top').length > 0) { 1036 var progressPath = document.querySelector('.pxl-scroll-top path'); 1037 var pathLength = progressPath.getTotalLength(); 1038 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 1039 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 1040 progressPath.style.strokeDashoffset = pathLength; 1041 progressPath.getBoundingClientRect(); 1042 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 1043 var updateProgress = function () { 1044 var scroll = $(window).scrollTop(); 1045 var height = $(document).height() - $(window).height(); 1046 var progress = pathLength - (scroll * pathLength / height); 1047 progressPath.style.strokeDashoffset = progress; 1048 } 1049 updateProgress(); 1050 $(window).scroll(updateProgress); 1051 var offset = 50; 1052 var duration = 550; 1053 $(window).on('scroll', function () { 1054 if ($(this).scrollTop() > offset) { 1055 $('.pxl-scroll-top').addClass('active-progress'); 1056 } else { 1057 $('.pxl-scroll-top').removeClass('active-progress'); 1058 } 1059 }); 1060 } 1061 } 1062 /* Button Parallax */ 1063 function herrington_text_parallax() { 1064 const $buttons = $('.pxl-info-box2'); 1065 if ($buttons.length === 0) { 1066 return; 1067 } 1068 $buttons.on('mouseenter', function () { 1069 const $text = $(this).find('svg'); 1070 if ($text.length === 0) { 1071 return; 1072 } 1073 gsap.set($text, { 1074 transformOrigin: "50% 50%" 1075 }); 1076 }); 1077 $buttons.on('mousemove', function (e) { 1078 const $btn = $(this); 1079 const $text = $btn.find('.pxl-title'); 1080 1081 if ($text.length === 0) { 1082 return; 1083 } 1084 const { left, top, width, height } = this.getBoundingClientRect(); 1085 const centerX = left + width / 2; 1086 const centerY = top + height / 2; 1087 const deltaX = (e.clientX - centerX) * 0.444; 1088 const deltaY = (e.clientY - centerY) * 0.444; 1089 gsap.to([$btn, $text], { 1090 duration: 0.8, 1091 x: deltaX, 1092 y: deltaY, 1093 ease: "power3.out" 1094 }); 1095 }); 1096 $buttons.on('mouseleave', function () { 1097 const $btn = $(this); 1098 const $text = $btn.find('.pxl-title'); 1099 if ($text.length === 0) { 1100 return; 1101 } 1102 gsap.to([$btn, $text], { 1103 duration: 0.8, 1104 x: 0, 1105 y: 0, 1106 ease: "elastic.out(1, 0.3)" 1107 }); 1108 }); 1109 } 1110 /* Custom Type File Upload*/ 1111 function herrington_type_file_upload() { 1112 1113 var multipleSupport = typeof $('<input/>')[0].multiple !== 'undefined', 1114 isIE = /msie/i.test(navigator.userAgent); 1115 1116 $.fn.pxl_custom_type_file = function () { 1117 1118 return this.each(function () { 1119 1120 var $file = $(this).addClass('pxl-file-upload-hidden'), 1121 $wrap = $('<div class="pxl-file-upload-wrapper">'), 1122 $button = $('<button type="button" class="pxl-file-upload-button">Choose File</button>'), 1123 $input = $('<input type="text" class="pxl-file-upload-input" placeholder="No File Choose" />'), 1124 $label = $('<label class="pxl-file-upload-button" for="' + $file[0].id + '">Choose File</label>'); 1125 $file.css({ 1126 position: 'absolute', 1127 opacity: '0', 1128 visibility: 'hidden' 1129 }); 1130 1131 $wrap.insertAfter($file) 1132 .append($file, $input, (isIE ? $label : $button)); 1133 1134 $file.attr('tabIndex', -1); 1135 $button.attr('tabIndex', -1); 1136 1137 $button.click(function () { 1138 $file.focus().click(); 1139 }); 1140 1141 $file.change(function () { 1142 1143 var files = [], fileArr, filename; 1144 1145 if (multipleSupport) { 1146 fileArr = $file[0].files; 1147 for (var i = 0, len = fileArr.length; i < len; i++) { 1148 files.push(fileArr[i].name); 1149 } 1150 filename = files.join(', '); 1151 } else { 1152 filename = $file.val().split('\\').pop(); 1153 } 1154 1155 $input.val(filename) 1156 .attr('title', filename) 1157 .focus(); 1158 }); 1159 1160 $input.on({ 1161 blur: function () { $file.trigger('blur'); }, 1162 keydown: function (e) { 1163 if (e.which === 13) { 1164 if (!isIE) { 1165 $file.trigger('click'); 1166 } 1167 } else if (e.which === 8 || e.which === 46) { 1168 $file.replaceWith($file = $file.clone(true)); 1169 $file.trigger('change'); 1170 $input.val(''); 1171 } else if (e.which === 9) { 1172 return; 1173 } else { 1174 return false;
1175 } 1176 } 1177 }); 1178 1179 }); 1180 1181 }; 1182 $('.wpcf7-file[type=file]').pxl_custom_type_file(); 1183 } 1184 1185 // preloader - start 1186 // -------------------------------------------------- 1187 // -------------------------------------------------- 1188 // // begin prelaoder script 1189 // window.onload = function () { 1190 // if($('.pxl-loader').length != 0){ 1191 // $('body').jpreLoader({ 1192 // splashID: "#jSplash", 1193 // splashFunction: function () { //passing Splash Screen script to jPreLoader 1194 // var timer = setInterval(function () { 1195 // splashRotator(); 1196 // }, 1); 1197 // } 1198 // }, function () { //jPreLoader callback function 1199 // clearInterval(); 1200 // $(function () { 1201 // var v_url = document.URL; 1202 1203 // if (v_url.indexOf('#') != -1) { 1204 // var v_hash = v_url.substring(v_url.indexOf("#") + 1); 1205 1206 1207 // $('html, body').animate({ 1208 // scrollTop: $('#' + v_hash).offset().top - 70 1209 // }, 200); 1210 // return false; 1211 // } 1212 // }); 1213 // }); 1214 // }else{ 1215 // $('#jpreOverlay').css('display','none'); 1216 // $('#jpreLoader').css('display','none'); 1217 // } 1218 1219 // } 1220 // // End of jPreLoader script 1221 // function splashRotator() { 1222 // var cur = $('#jSplash').children('.selected'); 1223 // var next = $(cur).next(); 1224 1225 // if ($(next).length != 0) { 1226 // $(next).addClass('selected'); 1227 // } else { 1228 // $('#jSplash').children('section:first-child').addClass('selected'); 1229 // next = $('#jSplash').children('section:first-child'); 1230 // } 1231 1232 // $(cur).removeClass('selected').fadeOut(100, function () { 1233 // $(next).fadeIn(100); 1234 // }); 1235 // } 1236 //divider blog 1237 function herrington_scroll_checkp_blog($scope) { 1238 $('.pxl-icon-list.style-5,.pxl-icon-box7').each(function () { 1239 var wcont1 = $(this); 1240 1241 1242 function checkScrollPosition() { 1243 var pxl_scroll_top = $(window).scrollTop(), 1244 viewportBottom = pxl_scroll_top + $(window).height(), 1245 elementTop = wcont1.offset().top, 1246 elementBottom = elementTop + wcont1.outerHeight(); 1247 1248 if (elementTop < viewportBottom && elementBottom > pxl_scroll_top) { 1249 wcont1.addClass('animated'); 1250 } 1251 } 1252 1253 checkScrollPosition(); 1254 1255 $(window).on('scroll', function () { 1256 checkScrollPosition(); 1257 }); 1258 1259 }); 1260 } 1261 1262 //Shop View Grid/List 1263 function herrington_shop_view_layout() { 1264 1265 $(document).on('click', '.pxl-view-layout .view-icon a', function (e) { 1266 e.preventDefault(); 1267 if (!$(this).parent('li').hasClass('active')) { 1268 $('.pxl-view-layout .view-icon').removeClass('active'); 1269 $(this).parent('li').addClass('active'); 1270 $(this).parents('.pxl-content-area').find('ul.products').removeAttr('class').addClass($(this).attr('data-cls')); 1271 } 1272 }); 1273 } 1274 1275 function herrington_height_ct_grid($scope) { 1276 $('.pxl-portfolio-grid-layout1 .pxl-grid-item,.pxl-portfolio-carousel2 .pxl-swiper-slide').each(function () { 1277 var elementHeight = $(this).find(".pxl-post-content-hide").height(); 1278 $(this).find(".pxl-post-content-hide").css("margin-bottom", "-" + elementHeight + "px"); 1279 }); 1280 1281 $('.pxl-icon-box7').each(function () { 1282 var elementHeight2 = $(this).find(".pxl-item--description").height(); 1283 $(this).find(".pxl-item--description").css("margin-bottom", "-" + elementHeight2 + "px"); 1284 }); 1285 } 1286 // Zoom Point 1287 function herrington_zoom_point() { 1288 $(".pxl-zoom-point").each(function () { 1289 1290 let scaleOffset = $(this).data('offset'); 1291 let scaleAmount = $(this).data('scale-mount'); 1292 1293 function scrollZoom() { 1294 const images = document.querySelectorAll("[data-scroll-zoom]"); 1295 let scrollPosY = 0; 1296 scaleAmount = scaleAmount / 100; 1297 1298 const observerConfig = { 1299 rootMargin: "0% 0% 0% 0%", 1300 threshold: 0 1301 }; 1302
1303 images.forEach(image => { 1304 let isVisible = false; 1305 const observer = new IntersectionObserver((elements, self) => { 1306 elements.forEach(element => { 1307 isVisible = element.isIntersecting; 1308 }); 1309 }, observerConfig); 1310 1311 observer.observe(image); 1312 1313 image.style.transform = `scale(${1 + scaleAmount * percentageSeen(image)})`; 1314 1315 window.addEventListener("scroll", () => { 1316 if (isVisible) { 1317 scrollPosY = window.pageYOffset; 1318 image.style.transform = `scale(${1 + 1319 scaleAmount * percentageSeen(image)})`; 1320 } 1321 }); 1322 }); 1323 1324 function percentageSeen(element) { 1325 const parent = element.parentNode; 1326 const viewportHeight = window.innerHeight; 1327 const scrollY = window.scrollY; 1328 const elPosY = parent.getBoundingClientRect().top + scrollY + scaleOffset; 1329 const borderHeight = parseFloat(getComputedStyle(parent).getPropertyValue('border-bottom-width')) + parseFloat(getComputedStyle(element).getPropertyValue('border-top-width')); 1330 const elHeight = parent.offsetHeight + borderHeight; 1331 1332 if (elPosY > scrollY + viewportHeight) { 1333 return 0; 1334 } else if (elPosY + elHeight < scrollY) { 1335 return 100; 1336 } else { 1337 const distance = scrollY + viewportHeight - elPosY; 1338 let percentage = distance / ((viewportHeight + elHeight) / 100); 1339 percentage = Math.round(percentage); 1340 1341 return percentage; 1342 } 1343 } 1344 } 1345 1346 scrollZoom(); 1347 1348 }); 1349 } 1350 1351 $(document).ready(function () { 1352 $(".btn-svg").on("mouseenter", function () { 1353 $(this).addClass("active"); 1354 }).on("mouseleave", function () { 1355 $(this).removeClass("active"); 1356 }); 1357 1358 1359 var socialShareWidth = $('.social-share').outerWidth(); 1360 $('.label').css('margin-right', '-' + (socialShareWidth + 2) + 'px'); 1361 1362 }); 1363 $(document).ready(function () { 1364 var svgPaths = $('.pxl-icon-list.style-5 svg path, .pxl-icon-list.style-5 svg line, .pxl-icon-list.style-5 svg circle,.pxl-icon-box7 .pxl-item--icon svg path,.pxl-icon-box7 .pxl-item--icon svg line,.pxl-icon-box7 .pxl-item--icon svg rect,.pxl-icon-box7 .pxl-item--icon svg circle'); 1365 var svgPaths_load = $('.pxl-icon-list.style-5 .animated svg path, .pxl-icon-list.style-5 .animated svg line, .pxl-icon-list.style-5 .animated svg circle'); 1366 1367 svgPaths.each(function () { 1368 var totalLength = this.getTotalLength(); 1369 1370 $(this).attr({ 1371 'stroke-dashoffset': totalLength, 1372 'stroke-dasharray': totalLength, 1373 }); 1374 }); 1375 }); 1376 1377 $(document).ready(function () { 1378 $('.pxl-nav-vertical .sub-menu').each(function () { 1379 var element = $(this); 1380 var offsetTop = element.offset().top; 1381 element.css('margin-top', `-${offsetTop}px`); 1382 }); 1383 }); 1384 1385 1386 // Fit to Screen 1387 function herrington_fit_to_screen() { 1388 $('.pxl-gallery-scroll.h-fit-to-screen').each(function () { 1389 var h_adminbar = 0; 1390 var h_section_header = 0; 1391 var h_section_footer = 0; 1392 if ($('#wpadminbar').length == 1) { 1393 h_adminbar = $('#wpadminbar').outerHeight(); 1394 } 1395 if ($('#pxl-header-elementor').length == 1) { 1396 h_section_header = $('#pxl-header-elementor').outerHeight(); 1397 } 1398 if ($('#pxl-footer-elementor').length == 1) { 1399 h_section_footer = $('#pxl-footer-elementor').outerHeight(); 1400 } 1401 var h_total = pxl_window_height - (h_adminbar + h_section_header + h_section_footer); 1402 $(this).css('height', h_total + 'px'); 1403 }); 1404 } 1405 1406 1407 $(document).on('click', function (event) { 1408 var clickedElement = $(event.target); 1409 var divWithClass = $('.pxl-icon-box6.active'); 1410 var divWithClass2 = $('.pxl-icon-box6 .content-2'); 1411 if (clickedElement.hasClass('pxl-icon-box6') && clickedElement.hasClass('active')) { 1412 return; 1413 }
1414 var isClickInsideDiv = divWithClass.has(clickedElement).length > 0; 1415 1416 if (!isClickInsideDiv) { 1417 divWithClass.removeClass('active'); 1418 divWithClass2.removeClass('active'); 1419 } 1420 }); 1421 1422 $(document).ready(function () { 1423 $(window).on('scroll', function () { 1424 let windowHeight = $(window).height(); 1425 let scrollPosition = $(window).scrollTop(); 1426 let hasActiveSection = false; 1427 $('[id^="ss-ct-"]').each(function () { 1428 let section = $(this); 1429 let sectionOffset = section.offset().top; 1430 let sectionHeight = section.outerHeight(); 1431 if ( 1432 scrollPosition + windowHeight / 2 >= sectionOffset && 1433 scrollPosition + windowHeight / 2 <= sectionOffset + sectionHeight 1434 ) { 1435 let sectionId = section.attr('id'); 1436 let targetClass = '.' + sectionId; 1437 $('.pxl-image_list .active').removeClass('active'); 1438 $(targetClass).addClass('active'); 1439 hasActiveSection = true; 1440 } 1441 }); 1442 if (!hasActiveSection) { 1443 } 1444 }); 1445 }); 1446 1447 1448 $(document).ready(function () { 1449 var $prices = $('.custom-text-radio li'); 1450 $('.wpcf7-list-item').each(function (index) { 1451 var $price = $($prices[index]); 1452 $(this).find('.wpcf7-list-item-label').append($price); 1453 }); 1454 $('.custom-text-radio').remove(); 1455 }); 1456 $('.wrap-ctf-insurance').each(function () { 1457 var $wrapper = $(this); 1458 $wrapper.find('.wpcf7-list-item').click(function () { 1459 $wrapper.find('.info').removeClass('active'); 1460 var index = $(this).index(); 1461 $wrapper.find('.info').eq(index).addClass('active'); 1462 }); 1463 }); 1464 1465})(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.