Главная / Модификации / Как добавить корзину в меню

Как добавить избранное
в меню Zero block Tilda?

0
<!--settings{"comment":"","favoritesClass":"favorites","classForQuantity":"quantity","linkForZero":"","countForZero":"0","iconCart980":"0","scaleOnHoverOff":""}settingsend--> <style> .quantity { user-select: none; display: none; } .favorites { cursor: pointer; } .t1002__wishlisticon { display: none; } .t1002__wishlisticon-counter { display: none; } .blkElem { pointer-events: none; } .cartcopyanim2 { -webkit-animation: nolim__pulse-anim 0.6s; animation: nolim__pulse-anim 0.6s; } @-webkit-keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1) } 60% { -webkit-transform: scale(1.25) } 100% { -webkit-transform: scale(1) } } @keyframes nolim__pulse-anim { 0% { -webkit-transform: scale(1); transform: scale(1) } 60% { -webkit-transform: scale(1.25); transform: scale(1.25) } 100% { -webkit-transform: scale(1); transform: scale(1) } } </style> <script> (function() { function n_ready(t) { "loading" != document.readyState ? t() : document.addEventListener ? document.addEventListener("DOMContentLoaded", t) : document.attachEvent("onreadystatechange", function() { "loading" != document.readyState && ( a = setInterval(function(){ if(window.$){ clearInterval(a); t(); } },50), setTimeout(function(){ clearInterval(a); },10000) ) }) } n_ready(function() { let a = setInterval(function() { let wishElemsAtomList = document.querySelectorAll('.favorites .tn-atom'); if (wishElemsAtomList.length > 0) { clearInterval(a); findWish065(); } }, 50); setTimeout(function() { clearInterval(a); }, 10000); function findWish065() { let wishElemsList = document.querySelectorAll(".favorites"); wishElemsList.forEach(function(item) { if (item.getAttribute("data-elem-type") == "image") { item.style.position = "absolute"; let img = item.querySelector(".tn-atom__img"); img.onload = function() { item.style.height = img.height + "px"; }; } if (item.getAttribute("data-elem-type") == "vector") { item.style.position = "absolute"; let vector = item.querySelector(".tn-atom__vector svg"); let rect = vector.getBoundingClientRect(); vector.onload = function() { item.style.height = vector.height + "px"; }; } }); $('.favorites').click(function(e) { e.preventDefault(); let int = setInterval(function() { if (window.twishlist){ clearInterval(int); if (window.twishlist.total > 0) { typeof twishlist__openCart != 'undefined' ? twishlist__openCart() : twishlist__openWishlist(); } } }, 50); }); function showCount(state) { let int = setInterval(function() { if (window.twishlist){ clearInterval(int); let nlcountz = window.twishlist.total; $('.quantity .tn-atom').html(nlcountz); if (nlcountz == 0) { $('.quantity').css('display', 'table'); $('.favorites').css('pointer-events', 'none'); } else { $('.favorites').css('pointer-events', 'all'); $('.quantity').css('display', 'table'); } if (state == "click") { $('.favorites').addClass('cartcopyanim2'); setTimeout(function() { $('.favorites').removeClass('cartcopyanim2'); }, 1000); } else if (state == "openpage") {} } }, 50); } showCount("openpage"); document.querySelector('body').addEventListener("click", function(e) { if (e.target.closest('.t1002__addBtn') || e.target.closest('.t1002__product-del') || e.target.matches('[href*="#addtofavorites"]') || e.target.closest('[href*="#addtofavorites"]')) { showCount("click"); } }, true); } }); })(); </script>
Скопировать код +