46 lines
1.7 KiB
JavaScript
46 lines
1.7 KiB
JavaScript
|
|
/* Set the width of the sidebar to 250px (show it) */
|
||
|
|
window.openCart = function() {
|
||
|
|
$('.basket-panel__mask').addClass('basket-panel__mask--visible');
|
||
|
|
$('.basket-panel__drawer').addClass('basket-panel__drawer--opened');
|
||
|
|
$('body').addClass('cartOpened');
|
||
|
|
}
|
||
|
|
|
||
|
|
/* Set the width of the sidebar to 0 (hide it) */
|
||
|
|
window.closeCart = function() {
|
||
|
|
$('.basket-panel__mask').removeClass('basket-panel__mask--visible');
|
||
|
|
$('.basket-panel__drawer').removeClass('basket-panel__drawer--opened');
|
||
|
|
$('body').removeClass('cartOpened');
|
||
|
|
}
|
||
|
|
|
||
|
|
window.showPromoInfo = function() {
|
||
|
|
$(this).parent().next("section.promotion-slide").show();
|
||
|
|
}
|
||
|
|
|
||
|
|
window.hidePromoInfo = function(elem) {
|
||
|
|
$(this).parent().next("section.promotion-slide").hide();
|
||
|
|
}
|
||
|
|
|
||
|
|
window.toggleFixingBottomCart= function() {
|
||
|
|
let bottomHeight = $('.cart-tile__bottom').innerHeight();
|
||
|
|
if($(this).scrollTop() + $(this).innerHeight() >= ($(this)[0].scrollHeight)) {
|
||
|
|
$('.cart-tile__bottom.cart-tile__bottom--fixed').removeClass('cart-tile__bottom--fixed')
|
||
|
|
} else if($(this).scrollTop() + $(this).innerHeight() < ($(this)[0].scrollHeight-bottomHeight)) {
|
||
|
|
$('.cart-tile__bottom').not('.cart-tile__bottom--fixed').addClass('cart-tile__bottom--fixed');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
window.toggleProductCategory = function() {
|
||
|
|
$(this).find('.category-heading__chevron').toggleClass('ds-chevron--revert');
|
||
|
|
$(this).next().toggle();
|
||
|
|
//raise a scroll event to check bottom cart fixing
|
||
|
|
$('.basket-panel__content--smooth-scroll').scroll();
|
||
|
|
}
|
||
|
|
|
||
|
|
window.showModalClearCart = function() {
|
||
|
|
$('#empty-basket-modal > div.modal').show();
|
||
|
|
}
|
||
|
|
|
||
|
|
window.closeModalClearCart = function() {
|
||
|
|
$('#empty-basket-modal > div.modal').hide();
|
||
|
|
}
|