Untitled
unknown
plain_text
a year ago
4.4 kB
8
Indexable
(function () {
try {
/* main variables */
var debug = 0;
var variation_name = "";
var $;
/* all Pure helper functions */
function waitForElement(selector, trigger, delayInterval, delayTimeout) {
var interval = setInterval(function () {
if (
document &&
document.querySelector(selector) &&
document.querySelectorAll(selector).length > 0
) {
clearInterval(interval);
trigger();
}
}, delayInterval);
setTimeout(function () {
clearInterval(interval);
}, delayTimeout);
}
function waitForSlick(trigger) {
var interval = setInterval(function () {
if (window.jQuery.fn.slick != undefined) {
clearInterval(interval);
trigger();
}
}, 50);
setTimeout(function () {
clearInterval(interval);
}, 15000)
}
function waitForjQuery(trigger) {
var interval = setInterval(function () {
if (window.jQuery != undefined) {
clearInterval(interval);
trigger();
}
}, 50);
setTimeout(function () {
clearInterval(interval);
}, 15000)
}
const testimonialsHtml = `
<div class="eg-testimonials">
<div class="eg-testimonials-wrapper">
<h2 class="eg-testimonials-title">Loved by Pets, Endorsed by Veterinarians</h2>
<div class="eg-reviewCards-container">
<div class="eg-cards-wrapper">
<div class="eg-card">
<div class="eg-card-img"></div>
<div class="eg-card-content">
<p class="eg-card-desc">“Meat should be raw. Cooking destroys enzymes and denatures the proteins rendering them less digestible to cats and dogs.”</p>
<p class="eg-card-name">Christina Chambreau, <span>DVM</span></p>
</div>
</div>
<div class="eg-card">
<div class="eg-card-img"></div>
<div class="eg-card-content">
<p class="eg-card-desc">“Dogs should eat raw food — raw meat and bones, vegetables and fruit. If they were meant to eat processed, sterilized food, they would have evolved with tin openers instead of dew claws.”</p>
<p class="eg-card-name">Nick Thompson, <span>BSc.(Hons), BVM&S, VetMFHom, MRCVS</span></p>
</div>
</div>
<div class="eg-card">
<div class="eg-card-img"></div>
<div class="eg-card-content">
<p class="eg-card-desc">“Meat should be raw. Cooking destroys enzymes and denatures the proteins rendering them less digestible to cats and dogs.”</p>
<p class="eg-card-name">Christina Chambreau, <span>DVM</span></p>
</div>
</div>
<div class="eg-card">
<div class="eg-card-img"></div>
<div class="eg-card-content">
<p class="eg-card-desc">“Dogs should eat raw food — raw meat and bones, vegetables and fruit. If they were meant to eat processed, sterilized food, they would have evolved with tin openers instead of dew claws.”</p>
<p class="eg-card-name">Nick Thompson, <span>BSc.(Hons), BVM&S, VetMFHom, MRCVS</span></p>
</div>
</div>
</div>
</div>
</div>
</div>`;
/* Variation Init */
function init() {
const testDestEl = document.querySelector('.experience-commerce_layouts-testimonialRegion');
if(!document.querySelector('.eg-testimonials')) {
testDestEl.insertAdjacentHTML('afterend', testimonialsHtml);
}
if(window.screen.width < 767) {
waitForjQuery(function () {
$ = window.jQuery;
waitForSlick(testmonialSlider);
});
}
}
function testmonialSlider() {
$('.eg-cards-wrapper').slick({
arrows: true,
dots: true,
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
loop: true,
});
}
/* Initialize variation */
waitForElement('.experience-commerce_layouts-testimonialRegion', init, 500, 15000);
} catch (e) {
if (debug) console.log(e, "error in Test" + variation_name);
}
})();
Editor is loading...
Leave a Comment