Website Sticky Promo Banner Bar for E-Commerce Website. Its has to disable/Close once it’s click on it.
Code examples conditional jQuery mobile / iPad / screen
Conditional jquery for full screen only, Min screen width 768 px if ($(window).width() > 767){
//your code
}
Conditional jquery for mobile and smaller devices only, Max screen width 768 px if ($(window).width() < 768){
//your code
}
Conditional jquery for iPad and full screen only, Min screen width 960 pxif ($(window).width() > 960){
//your code
}
Conditional jquery for older, smaller devices and screens, Max screen width 479 pxif ($(window).width() < 479){
//your code
}
Setting the Cookies
Reference https://www.electrictoolbox.com/jquery-cookies/
if ($('.promo_banner').length){ var promo_banner = Cookies.get('promo_banner'); console.log(promo_banner); if (promo_banner != 'dismiss') { $('body').addClass('promo_banner-show'); if ($(window).width() < 768){ $(".header_desk_mobile").css({'top':'30px'}); } $('.promo_banner').on('click', '.promo_banner-close', function(){ $('body').removeClass('promo_banner-show'); if ($(window).width() < 768){ $(".header_desk_mobile").css({'top':'0'}); } Cookies.set('promo_banner', 'dismiss', { expires: 30 }); }); } }