I would like to trigger the shopping cart animation (same as on mouseover) whenever somebody put someting in the cart. What javascript function can I use?
Hi,
You can check the following code, which we use in our Wordpress theme version of Mojado
$body.on('adding_to_cart', function(e, $button) { var $product = $button.parents('.product-grid'); var $imgDrag = getProductImage($product); if ($imgDrag) { var $imgClone = $imgDrag.clone(); $imgClone.offset({ top: $imgDrag.offset().top, left: $imgDrag.offset().left }); $imgClone.css({ 'opacity': '0.75', 'position': 'absolute', 'height': '150px', 'width': '150px', 'z-index': '999999' }); $imgClone.appendTo($body); $imgClone.animate({ 'top': $cart.offset().top + 10, 'left': $cart.offset().left + 10, 'width': 75, 'height': 75 }, 1000); $imgClone.animate({ 'width': 0, 'height': 0 }, function () { $(this).detach(); }); } });
Hi,
You can check the following code, which we use in our Wordpress theme version of Mojado