Created
March 26, 2015 17:30
-
-
Save fusspawn/3355b1758b74c3d7108f to your computer and use it in GitHub Desktop.
This file contains 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 type="text/javascript"> | |
jQuery(document).on('added_to_cart', function () { | |
var cart = jQuery('.cart-contents'); | |
var imgtodrag = jQuery(this.activeElement).parents(".dp_product_item").find("img").eq(0); | |
if (imgtodrag) { | |
var imgclone = imgtodrag.clone() | |
.offset({ | |
top: imgtodrag.offset().top, | |
left: imgtodrag.offset().left | |
}); | |
imgclone.css({ | |
'opacity': '0.5', | |
'position': 'absolute', | |
'height': '150px', | |
'width': '150px', | |
'z-index': '10000' | |
}) | |
imgclone.appendTo(jQuery('body')) | |
imgclone.animate({ | |
'top': jQuery('.cart-contents').offset().top + 10, | |
'left': jQuery('.cart-contents').offset().left + 10, | |
'width': 75, | |
'height': 75 | |
}, 1000, 'easeInOutExpo'); | |
setTimeout(function () { | |
cart.effect("shake", { | |
times: 2 | |
}, 200); | |
}, 1500); | |
imgclone.animate({ | |
'width': 0, | |
'height': 0 | |
}, function () { | |
jQuery(this).detach() | |
}); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment