Fix product clothes size btn
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -4277,31 +4277,48 @@ function customSticky() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var sizeTabLink = $('.product-tabs .nav-link[href="#extra-0"]')
|
|
||||||
|
|
||||||
if (sizeTabLink.length) {
|
function initSizeChartButton() {
|
||||||
var lang = window.location.pathname.split('/')[1]
|
|
||||||
var buttonText = lang === 'pl' ? 'TABELA ROZMIARÓW' : 'SIZE CHART'
|
|
||||||
|
|
||||||
var sizeTableBtn = $(
|
var sizeTabLink = $('.product-tabs .nav-link[href="#extra-0"]');
|
||||||
'<a href="#" class="btn btn-outline-secondary mb-1 product-size-tab" style="display:block;">' +
|
if (!sizeTabLink.length) return;
|
||||||
buttonText +
|
|
||||||
'</a>'
|
|
||||||
)
|
|
||||||
|
|
||||||
var $rozmiarVariant = $(
|
if ($('.product-size-tab').length) return;
|
||||||
'.product-variants .product-variants-item[data-variant="rozmiar"]'
|
|
||||||
)
|
|
||||||
if ($rozmiarVariant.length) {
|
|
||||||
$rozmiarVariant.addClass('set-size-chart')
|
|
||||||
$rozmiarVariant.after(sizeTableBtn)
|
|
||||||
}
|
|
||||||
|
|
||||||
sizeTableBtn.on('click', function () {
|
var lang = window.location.pathname.split('/')[1];
|
||||||
sizeTabLink.tab('show')
|
var buttonText = lang === 'pl'
|
||||||
|
? 'TABELA ROZMIARÓW'
|
||||||
|
: 'SIZE CHART';
|
||||||
|
|
||||||
var tabsOffset = $('.product-tabs').offset().top
|
var sizeTableBtn = $(
|
||||||
$('html, body').animate({ scrollTop: tabsOffset - 100 }, 600)
|
'<a href="#" class="btn btn-outline-secondary mb-1 product-size-tab" style="display:block;">' +
|
||||||
})
|
buttonText +
|
||||||
}
|
'</a>'
|
||||||
})
|
);
|
||||||
|
|
||||||
|
var $rozmiarVariant = $('.product-variants .product-variants-item[data-variant="rozmiar"]');
|
||||||
|
|
||||||
|
if ($rozmiarVariant.length) {
|
||||||
|
$rozmiarVariant.addClass('set-size-chart');
|
||||||
|
$rozmiarVariant.after(sizeTableBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
sizeTableBtn.on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
sizeTabLink.tab('show');
|
||||||
|
|
||||||
|
var tabsOffset = $('.product-tabs').offset().top;
|
||||||
|
$('html, body').animate({ scrollTop: tabsOffset - 100 }, 600);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initSizeChartButton();
|
||||||
|
|
||||||
|
if (typeof prestashop !== 'undefined') {
|
||||||
|
prestashop.on('updatedProduct', function () {
|
||||||
|
setTimeout(initSizeChartButton, 100);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user