-
-
Save swym-public/de718df188e6a81301471d4da89536d6 to your computer and use it in GitHub Desktop.
Header filled icon on product add
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script defer> | |
| function renderWishlistHeader(swat) { | |
| var spanElement = document.querySelector(".swym-hidden-counter"); | |
| var headerElements = document.querySelectorAll(".swym-wishlist"); | |
| if(swat && swat.renderWishlistCount){ | |
| swat.renderWishlistCount(spanElement, function(cnt, elem){ | |
| headerElements.forEach(function(hElement){ | |
| if(cnt == 0){ | |
| if(hElement.classList.contains("swym-added-header")){ | |
| hElement.classList.remove("swym-added-header"); | |
| } | |
| }else{ | |
| if (!hElement.classList.contains("swym-added-header")) { | |
| hElement.classList.add("swym-added-header"); | |
| } | |
| } | |
| }) | |
| }); | |
| } | |
| } | |
| if(!window.SwymCallbacks){ | |
| window.SwymCallbacks = []; | |
| } | |
| window.SwymCallbacks.push(renderWishlistHeader); | |
| </script> | |
| <style> | |
| a.swym-wishlist.swym-added-header i.icon.icon-swym-wishlist:after { | |
| content: "\f004" !important; | |
| } | |
| /* hide the counter */ | |
| .swym-hidden-counter { | |
| display: none; | |
| } | |
| </style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this style to show wishlist header heart icon even when wishlist is empty count
i.icon.icon-swym-wishlist:after { content: "" !important; }