The repo for Purrform's main BigCommerce store.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: cart icon animation

+43 -3
+1 -1
config.json
··· 1 1 { 2 - "name": "cart total preview", 2 + "name": "cart icon animation", 3 3 "version": "6.10.0", 4 4 "template_engine": "handlebars_v4", 5 5 "meta": {
+42 -2
templates/components/common/navigation.html
··· 129 129 href="{{urls.cart}}" 130 130 aria-label="{{lang 'cart.nav_aria_label'}}" 131 131 > 132 - <svg><use xlink:href="#icon-cart" /> 132 + <svg class="cartIcon"><use xlink:href="#icon-cart" /> 133 133 </svg> 134 134 <p class="pill-container"><span class="countPill cart-quantity"></span><span class="cart-contents"> Items</span></p> 135 135 <span class="navUser-item-cartLabel"></span> ··· 209 209 if (mutation.type === "childList") { 210 210 // if the child node that changed is the cart quantity, update the cart total 211 211 if (mutation.target.classList.contains('countPill')) { 212 + document.querySelector('.cartIcon').classList.add('wiggle'); 212 213 getCartTotal().then(formattedTotal => { 213 214 document.querySelector('.navUser-item-cartLabel').textContent = formattedTotal; 214 215 }).catch(error => { 215 216 document.querySelector('.navUser-item-cartLabel').textContent = ''; 216 217 }); 218 + setTimeout(() => { 219 + document.querySelector('.cartIcon').classList.remove('wiggle'); 220 + }, 2000); 217 221 } 218 222 } 219 223 } ··· 225 229 // Start observing the target node for configured mutations 226 230 observer.observe(targetNode, config); 227 231 228 - </script> 232 + </script> 233 + 234 + <style> 235 + .wiggle { 236 + animation: wiggle 2s linear; 237 + } 238 + 239 + @keyframes wiggle { 240 + 0%, 7% { 241 + transform: rotateZ(0); 242 + scale: 1; 243 + } 244 + 15% { 245 + transform: rotateZ(-15deg); 246 + } 247 + 20% { 248 + transform: rotateZ(10deg); 249 + } 250 + 25% { 251 + transform: rotateZ(-10deg); 252 + } 253 + 30% { 254 + transform: rotateZ(6deg); 255 + scale: 1.15; 256 + } 257 + 35% { 258 + transform: rotateZ(-4deg); 259 + } 260 + 40%, 100% { 261 + transform: rotateZ(0); 262 + } 263 + 70% { 264 + scale: 1; 265 + } 266 + 267 + } 268 + </style>