2026-02-05 17:08:59 +03:00

1 line
2.3 KiB
JavaScript

!function(e){"use strict";let i;function t(e,i){var t,n=e.children(".review").first(),a=e.children(".active-testimonial");a.length?(a.removeClass("active-testimonial"),(t=a.next()).length?t.addClass("active-testimonial"):n.addClass("active-testimonial")):n.addClass("active-testimonial"),e.css("height",e.children(".active-testimonial").height()),i.length&&(i.removeClass("activeSlide"),i.eq(e.children().index(e.children(".active-testimonial"))).addClass("activeSlide"))}e.fn.initTestimonials=function(){function n(n,a){e.each(n,(function(n,a){var s="IntersectionObserver"in window,r=e(s?a.target:a),l=r.parent(),c=l.children(".testimonial-pagination"),o=c.length?c.children():{};(s&&a.isIntersecting||!s)&&(r.css("height",r.children(".active-testimonial").height()),l.data("speed")&&(clearInterval(l.data("interval")),i=setInterval((function(){t(r,o)}),l.data("speed")),l.data("interval",i)),o.length&&o.on("click",(function(n){n.preventDefault(),o.removeClass("activeSlide"),e(this).addClass("activeSlide"),r.children().removeClass("active-testimonial").eq(o.index(e(this))).addClass("active-testimonial"),r.css("height",r.children(".active-testimonial").height()),l.data("speed")&&(clearInterval(l.data("interval")),i=setInterval((function(){t(r,o)}),l.data("speed")),l.data("interval",i))}))),s&&!a.isIntersecting&&l.data("speed")&&clearInterval(l.data("interval"))}))}"IntersectionObserver"in window?e(this).each((function(){var i=fusion.getAnimationIntersectionData(e(this)),t=new IntersectionObserver((function(e,i){n(e,t)}),i);e(this).each((function(){t.observe(this)}))})):e(this).each((function(){n(e(this),!1)}))}}(jQuery),jQuery(window).on("load fusion-element-render-fusion_testimonials",(function(e,i){let t=void 0!==i?jQuery('div[data-cid="'+i+'"]').find(".reviews"):jQuery(".fusion-testimonials .reviews");void 0===i||t.length||(t=jQuery('div[data-cid="'+i+'"]').parents(".fusion-testimonials").first().find(".reviews")),t.initTestimonials(),jQuery(window).on("fusion-resize-horizontal",(function(){jQuery(".fusion-testimonials .reviews").each((function(){jQuery(this).css("height",jQuery(this).children(".active-testimonial").height())}))}))})),jQuery(window).on("fusion-dynamic-content-render",(function(e,i){var t=jQuery(i).find(".fusion-testimonials .reviews");0<t.length&&t.each((function(){jQuery(this).css("height",jQuery(this).children(".active-testimonial").height())}))}));