jQuery(function($){ "use strict"; jQuery('.main-menu-navigation > ul').superfish({ delay: 500, animation: {opacity:'show',height:'show'}, speed: 'fast' }); }); function affiliate_marketing_business_menu_open() { jQuery(".menu-brand.primary-nav").addClass('show'); } function affiliate_marketing_business_menu_close() { jQuery(".menu-brand.primary-nav").removeClass('show'); } var affiliate_marketing_business_Keyboard_loop = function (elem) { var affiliate_marketing_business_tabbable = elem.find('select, input, textarea, button, a').filter(':visible'); var affiliate_marketing_business_firstTabbable = affiliate_marketing_business_tabbable.first(); var affiliate_marketing_business_lastTabbable = affiliate_marketing_business_tabbable.last(); /*redirect last tab to first input*/ affiliate_marketing_business_lastTabbable.on('keydown', function (e) { if ((e.which === 9 && !e.shiftKey)) { e.preventDefault(); affiliate_marketing_business_firstTabbable.focus(); } }); /*redirect first shift+tab to last input*/ affiliate_marketing_business_firstTabbable.on('keydown', function (e) { if ((e.which === 9 && e.shiftKey)) { e.preventDefault(); affiliate_marketing_business_lastTabbable.focus(); } }); /* allow escape key to close insiders div */ elem.on('keyup', function (e) { if (e.keyCode === 27) { elem.hide(); } ; }); }; // scroll jQuery(document).ready(function () { jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 0) { jQuery('#scrollbutton').fadeIn(); } else { jQuery('#scrollbutton').fadeOut(); } }); jQuery(window).on("scroll", function () { document.getElementById("scrollbutton").style.display = "block"; }); jQuery('#scrollbutton').click(function () { jQuery("html, body").animate({ scrollTop: 0 }, 600); return false; }); }); jQuery(function($){ $('.mobiletoggle').click(function () { affiliate_marketing_business_Keyboard_loop($('.menu-brand.primary-nav')); }); $(document).ready(function(){ $(".product-category").hide(); $("button.product-button").click(function(){ $(".product-category").toggle(); }); }); $(document).ready(function(){ $(".product-cat").hide(); $("button.product-btn").click(function(){ $(".product-cat").toggle(); }); }); }); // preloader jQuery(function($){ setTimeout(function(){ $(".frame").delay(1000).fadeOut("slow"); }); }); jQuery('document').ready(function($){ $('.main-search span a').click(function(){ $(".searchform_page").slideDown(500); affiliate_marketing_business_Keyboard_loop($('.searchform_page')); }); $('.close a').click(function(){ $(".searchform_page").slideUp(500); }); }); jQuery(document).ready(function () { function affiliate_marketing_business_search_loop_focus(element) { var affiliate_marketing_business_focus = element.find('select, input, textarea, button, a[href]'); var affiliate_marketing_business_firstFocus = affiliate_marketing_business_focus[0]; var affiliate_marketing_business_lastFocus = affiliate_marketing_business_focus[affiliate_marketing_business_focus.length - 1]; var KEYCODE_TAB = 9; element.on('keydown', function affiliate_marketing_business_search_loop_focus(e) { var isTabPressed = (e.key === 'Tab' || e.keyCode === KEYCODE_TAB); if (!isTabPressed) { return; } if ( e.shiftKey ) /* shift + tab */ { if (document.activeElement === affiliate_marketing_business_firstFocus) { affiliate_marketing_business_lastFocus.focus(); e.preventDefault(); } } else /* tab */ { if (document.activeElement === affiliate_marketing_business_lastFocus) { affiliate_marketing_business_firstFocus.focus(); e.preventDefault(); } } }); } jQuery('.toggle-btn a').click(function(){ jQuery(".header-sidebar").addClass('show'); affiliate_marketing_business_search_loop_focus(jQuery('.header-sidebar')); }); jQuery('.header-sidebar .close-pop a').click(function(){ jQuery(".header-sidebar").removeClass('show'); }); }); // Countdown jQuery(document).ready(function($) { $('.countdown-timer').each(function() { var $affiliate_marketing_business_this = $(this); var saleEndDate = $affiliate_marketing_business_this.data('sale-end'); if (saleEndDate) { var countDownDate = new Date(saleEndDate * 1000).getTime(); var x = setInterval(function() { var now = new Date().getTime(); var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); var countdownHtml = `
${days}
Day
${hours}
Hrs
${minutes}
Min
${seconds}
Sec
`; $affiliate_marketing_business_this.find('#countdown').html(countdownHtml); if (distance < 0) { clearInterval(x); $affiliate_marketing_business_this.find('#countdown').html("SALE ENDED"); } }, 1000); } }); });