This commit is contained in:
Roman Pyrih
2024-12-10 14:40:33 +01:00
parent 8568a1f35b
commit 18ddbf8313
2 changed files with 30 additions and 4 deletions

View File

@@ -31,6 +31,14 @@ $(function () {
activateProductColors(boxHref)
activateProductDrafts(boxHref)
activateProductBanner(boxHref)
if ($(this).attr('colors')) {
$('#product-colors-preview-box').show();
let colorsArr = $(this).attr('colors').split(' ');
activateProductColorsTabs(colorsArr);
} else {
$('#product-colors-preview-box').hide();
}
})
function activateProductBox(boxHref) {
@@ -74,11 +82,29 @@ $(function () {
})
}
}
})
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function activateProductColorsTabs(colors) {
console.log(colors);
if (colors && typeof colors === 'object') {
$('#nav_tabs_colors li').each(function() {
var href = $(this).find('a').attr('href').substring(1);
if (!colors.includes(href)) {
$(this).hide();
} else {
$(this).show();
}
});
let firstVisible = $('#nav_tabs_colors li:visible').first();
if (firstVisible.length > 0) {
firstVisible.find('a').trigger('click');
}
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$(function() {
var productColorsList = $("#product-colors-preview-box .scontainer-content")
$("#nav_tabs_colors li a").on("click", function (e) {

View File

@@ -3,7 +3,7 @@
<div class="box-1">
<div class="c-row">
<img alt="" src="/upload/filemanager/pages/Promozione-invernale/PZ-podstrona-IT.jpg" />
<img alt="" src="/upload/filemanager/pages/Promozione-invernale/PZ-podstrona-IT-NEW.png" />
</div>
</div>