jQuery(document).ready(function (){
stm_switcher();
js_active_trigger();
js_active_switch();
close_mobile_header();
});
function js_active_switch(){
jQuery('.js_active_switcher .js_active_switcher__a').on('click', function (e){
e.preventDefault();
jQuery(this).closest('.js_active_switcher').find('.js_active_switcher__a').removeClass('active');
jQuery(this).addClass('active');
})
}
function js_active_trigger(){
var opened=false;
var dataToggle='';
var jQueryelement='';
var jQuerythis='';
jQuery('.js_trigger__click').on('click', function (e){
e.preventDefault();
e.stopPropagation();
jQuerythis=jQuery(this);
dataToggle=jQuery(this).attr('data-toggle');
if(typeof dataToggle=='undefined') dataToggle=true;
jQueryelement=jQuery(this).closest('.js_trigger').find('.js_trigger__unit');
var element=jQuery(this).attr('data-element');
if(typeof element!=='undefined') jQueryelement=jQuery(element);
if(dataToggle&&dataToggle!=='false'){
jQueryelement.slideToggle('fast');
}else{
jQueryelement.toggleClass('active');
}
jQuery(this).toggleClass('active');
opened=jQuery(this).hasClass('active') ? true:false;
});
}
function stm_switcher(){
jQuery('.stm-switcher__trigger').on("click", function (){
jQuery(this).closest('.stm-switcher').find('.stm-switcher__list').toggleClass('active');
jQuery(this).toggleClass('active');
jQuery('div.page-wrapper').toggleClass('active');
});
jQuery('.stm-switcher__option').on("click", function (){
var stm_switch=jQuery(this).data('switch');
jQuery(this).closest('.stm-switcher').parent().find('.js-switcher').addClass('js-switcher__hidden');
jQuery(this).closest('.stm-switcher').parent().find('.js-switcher_' + stm_switch).removeClass('js-switcher__hidden');
jQuery(this).closest('.stm-switcher').find('.stm-switcher__text').text(jQuery(this).text());
jQuery(this).closest('.stm-switcher__list').removeClass('active');
jQuery(this).closest('.stm-switcher').find('.stm-switcher__trigger').removeClass('active');
});
}
function close_mobile_header(){
jQuery('.stm-header__overlay').on('click', function(e){
jQuery('.stm-header__overlay, .stm-header, .stm_mobile__switcher').removeClass('active');
});
jQuery('.stm-navigation li.menu-item-has-children > a').each(function (){
var href=jQuery(this).attr("href");
if(href=="#"){
jQuery(this).parent().addClass('href_empty');
}
jQuery(this).append('<span class="stm_mobile__dropdown"></span>');
});
jQuery('body').find('.stm_mobile__dropdown').on('click', function (e){
e.preventDefault();
e.stopPropagation();
jQuery(this).closest('li').toggleClass('active');
jQuery(this).closest('li').children('.sub-menu').toggle();
});
}
jQuery(document).ready(function ($){
$('.collapsible-trigger-btn').on('click', function (){
const $btn=$(this);
const $content=$btn.next('.collapsible-content--small');
if($btn.hasClass('is-transitioning')) return;
$btn.addClass('is-transitioning');
const isExpanded=$btn.attr('aria-expanded')==='true';
$btn.addClass('animation_footer_menu');
setTimeout(()=> $btn.removeClass('animation_footer_menu'), 500);
if(!isExpanded){
$btn.addClass('is-open').attr('aria-expanded', 'true');
$content.addClass('is-open');
$content.css({
display: 'block',
position: 'relative',
height: 'auto',
overflow: 'hidden'
});
const fullHeight=$content[0].scrollHeight + 'px';
$content.css('height', '0px');
requestAnimationFrame(()=> {  $content.css('height', fullHeight+35); });
}else{
const currentHeight=$content[0].scrollHeight + 'px';
$content.css('height', currentHeight);
requestAnimationFrame(()=> {
$content.css('height', '0px');
});
$btn.removeClass('is-open').attr('aria-expanded', 'false');
$content.removeClass('is-open');
}
$content.one('transitionend webkitTransitionEnd', ()=> {
if($content.hasClass('is-open')){
$content.css('height', 'auto');
}else{
$content.css('display', '');
}});
setTimeout(()=> {
$btn.removeClass('is-transitioning');
}, 40);
});
});
jQuery(document).ready(function (){
jQuery(".cart_rounded").on('click',function(){
if(! (window.location.href=="https://www.macansys.co.uk/bag/")){
jQuery("div.xoo-wsc-modal").toggleClass('xoo-wsc-cart-active');
}else{
window.location.assign('https://www.macansys.co.uk/bag/');
}});
jQuery(document).on('click', '.cart-contents ', function(e){
e.preventDefault();
if(window.location.href!=="https://www.macansys.co.uk/bag/"){
jQuery("div.xoo-wsc-modal").toggleClass('xoo-wsc-cart-active');
}else{
window.location.assign('https://www.macansys.co.uk/bag/');
}});
jQuery(".xoo-wsc-icon-cross").on('click',function(){
if(! (window.location.href=="https://www.macansys.co.uk/bag/")){
jQuery("div.xoo-wsc-modal").toggleClass('xoo-wsc-cart-active');
}else{
window.location.assign('https://www.macansys.co.uk/bag/');
}});
});
jQuery(document).ready(function (){
var flickity_slider_translateX=200; var first_run=1;
setInterval(()=> {
if(flickity_slider_translateX===200&&first_run==0){
flickity_slider_translateX=100;
jQuery('#AnnouncementSlide-d650207f-31a0-4032-bbbe-156bc3237a48').attr("style","position: absolute; left: 0px; transform: translateX(200%);display:block;");
jQuery('#AnnouncementSlide-d650207f-31a0-4032-bbbe-156bc3237a50').attr("style","position: absolute; left: 0px; transform: translateX(200%);display:block;");
jQuery('.flickity-slider').attr("style","left: 0px; transform: translateX(-200%);transition: transform 0.8s;");
setTimeout(function (){
jQuery('#AnnouncementSlide-a80a31a6-3837-49a5-9ac3-11927732cf70').attr("style","position: absolute;left: 0px;transform: translateX(100%);transition: opacity;display:none;");
jQuery('#AnnouncementSlide-a80a31a6-3837-49a5-9ac3-11927732cf72').attr("style","position: absolute;left: 0px;transform: translateX(100%);transition: opacity;display:none;");
}, 300);
}else{
first_run=0;
flickity_slider_translateX=200;
jQuery('#AnnouncementSlide-a80a31a6-3837-49a5-9ac3-11927732cf70').attr("style","position: absolute;left: 0px;transform: translateX(100%);transition: opacity; display:block;");
jQuery('#AnnouncementSlide-a80a31a6-3837-49a5-9ac3-11927732cf72').attr("style","position: absolute;left: 0px;transform: translateX(100%);transition: opacity; display:block;");
jQuery('.flickity-slider').attr("style","left: 0px; transform: translateX(-100%);transition: transform 0.8s;");
setTimeout(function (){
jQuery('#AnnouncementSlide-d650207f-31a0-4032-bbbe-156bc3237a48').attr("style","position: absolute; left: 0px; transform: translateX(200%);display:none;");
jQuery('#AnnouncementSlide-d650207f-31a0-4032-bbbe-156bc3237a50').attr("style","position: absolute; left: 0px; transform: translateX(200%);display:none;");
}, 300);
}}, 8000);
});
jQuery(document).ready(function (){
jQuery('#username').attr("maxlength", "100");
jQuery('#password').attr("maxlength", "100");
jQuery('#reg_email').attr("maxlength", "100");
jQuery('#reg_password').attr("maxlength", "100");
});
/*jQuery(function($){
if($("body.single-product").length){
$.fn.block=function(){
if($(this).hasClass("summary")){
$(this).removeClass("processing").unblock();
return this;
}
return $.fn.block.apply(this, arguments);
};}});*/;