https://i.sstatic.net/SQDeE.png
I need to relocate an image (which is an octopus) from a large gray container (#large
) to a small orange box (#small
) below it using the following jQuery code:
$(document).on("click", "#large > img", function() {
$(this).appendTo("#small");
});
The current functionality works perfectly, but I want to enhance it by adding a smooth transition effect to make the octopus 'fly' over smoothly with gradually changing size and position.
I attempted to include a CSS transition property like this:
img { transition: all 3s; }
However, this method doesn't work because the image is actually reinserted into the DOM instead of simply being moved. Can anyone suggest how to achieve such an animation effect?