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 () {
|
||||
var sizeTabLink = $('.product-tabs .nav-link[href="#extra-0"]')
|
||||
|
||||
if (sizeTabLink.length) {
|
||||
var lang = window.location.pathname.split('/')[1]
|
||||
var buttonText = lang === 'pl' ? 'TABELA ROZMIARÓW' : 'SIZE CHART'
|
||||
function initSizeChartButton() {
|
||||
|
||||
var sizeTableBtn = $(
|
||||
'<a href="#" class="btn btn-outline-secondary mb-1 product-size-tab" style="display:block;">' +
|
||||
buttonText +
|
||||
'</a>'
|
||||
)
|
||||
var sizeTabLink = $('.product-tabs .nav-link[href="#extra-0"]');
|
||||
if (!sizeTabLink.length) return;
|
||||
|
||||
var $rozmiarVariant = $(
|
||||
'.product-variants .product-variants-item[data-variant="rozmiar"]'
|
||||
)
|
||||
if ($rozmiarVariant.length) {
|
||||
$rozmiarVariant.addClass('set-size-chart')
|
||||
$rozmiarVariant.after(sizeTableBtn)
|
||||
}
|
||||
if ($('.product-size-tab').length) return;
|
||||
|
||||
sizeTableBtn.on('click', function () {
|
||||
sizeTabLink.tab('show')
|
||||
var lang = window.location.pathname.split('/')[1];
|
||||
var buttonText = lang === 'pl'
|
||||
? 'TABELA ROZMIARÓW'
|
||||
: 'SIZE CHART';
|
||||
|
||||
var tabsOffset = $('.product-tabs').offset().top
|
||||
$('html, body').animate({ scrollTop: tabsOffset - 100 }, 600)
|
||||
})
|
||||
}
|
||||
})
|
||||
var sizeTableBtn = $(
|
||||
'<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