<script>
$(document).ready(function(){
$(".gallery-tabs_1").addClass('active-zero-tab');
$('div[class*="gallery-tabs_"]').click(function(){
let recBlk = $(this).closest('.t-rec');
recBlk.find('div[class*="gallery-tabs_"]').removeClass('active-zero-tab');
$(this).addClass('active-zero-tab');
let tabsLng = recBlk.find('div[class*="gallery-tabs_"]').length;
let classTabs = $(this).attr('class');
let tabIndex = 0;
for (let i=1; i<=tabsLng;i++){
let contain = classTabs.includes('gallery-tabs_'+i);
if (contain) tabIndex=i;
};
recBlk.find('.zerogallery div[data-slide-bullet-for="'+tabIndex+'"]').click();
});
function sldchange() {
let observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "data-slider-pos") {
let attributeValue = $(mutation.target).prop(mutation.attributeName);
let posSld = $(mutation.target).attr('data-slider-pos');
let currentRec = $(mutation.target).closest('.t-rec');
currentRec.find('div[class*="gallery-tabs_"]').removeClass('active-zero-tab');
currentRec.find('.gallery-tabs_'+posSld).addClass('active-zero-tab');
console.log(posSld);
};
});
});
$(".zerogallery .t-slds__items-wrapper").each(function() {
observer.observe(this, {
attributes: true
});
});
};
function checksld(){
if ($('.zerogallery .t-slds').length) {
sldchange(); clearInterval(sldinterval);
};};let sldinterval = setInterval(checksld , 200);
});
</script>
<style>
.tn-elem[class*="gallery-tabs_"] {
cursor: pointer;
transition:all 0.3s ease-in-out;
}
.active-zero-tab{
font-weight: 800;
text-decoration: underline;
padding-left: 20px;
}
</style>