jquery – Flying pictures to the basket?

Question:

Hello everyone. Implemented the flight of the product image to the basket, everything works fine

var cart_offset = $("#cart").offset(); //координаты корзины
   var cart_img = $this.parents('.product').find('img.boss');
   console.log(cart_img);
     $('<style id="transferEffect" type="text/css">' + '.ui-effects-transfer { z-index:10000000; opacity:0.5; border:1px solid #000000; background-image: url(' + $(cart_img).attr('src') + '); }' + '</style>').appendTo('head');
    $(cart_img).effect("transfer", {
        clone: cart_img,
        to: $("#cart")
    }, 750);

You can view it here

But there is a joke, the picture flies away but does not shrink in size? how to make it decrease in size?

Answer:

add: background-size: cover

Scroll to Top