Jquery fly to cart animation-Collection of common programming errors
I am trying to add fly to cart animation to woocommerce plugin, in order to get this I have used the following code
jQuery(document).ready(function(e){e(document).on("click",".add_to_cart_button",function(){var t=e(this);if(t.is(".product_type_simple, .product_type_downloadable, .product_type_virtual")){
var cart = $('.widget_shopping_cart_content');
var imgtodrag = $('.event img').eq(0);
var imgclone = imgtodrag.clone()
.offset({
top: imgtodrag.offset().top,
left: imgtodrag.offset().left
})
.css({
'opacity': '0.5',
'position': 'absolute',
'height': '150px',
'width': '150px',
'z-index': '100',
})
.appendTo($('body'))
.animate({
'top': cart.offset().top + 10,
'left': cart.offset().left + 10,
'width': 75,
'height': 75,
});
setTimeout(function () {
cart.effect("shake", {
times: 2
}, 200);
}, 1500);
imgclone.animate({
'width': 0,
'height': 0
}, function () {
$(this).detach()
});
}
);
Every time I run this code I get error “Uncaught TypeError: Object # has no method ‘css’ “, i have tried different methods of selecting the image but I get the same error every time.
Any help or pin pointing me to the right direction will help.