Mouseover effect to spread superimposed icons/images

Asked

Viewed 77 times

2

Hello, on the system I am working on there are some icons/images (which are div’s) that are sometimes superimposed. This is the correct functioning of them, they update their positions automatically and sometimes stay on top of each other, but it is necessary to create a functionality in the system so that when placing the mouse on the superimposed images, they spread (like an explosion), which could be in circular shape around the mouse pointer. I tried to do with jQuery using the Animate method and with Javascript using offset but I haven’t been successful yet. If anyone has any tips I will be immensely grateful.

var img = $(Document.createelement('div')). attr({ class: 'icon' }). css('left', left);

                $(img).mouseover(function () {
                    $(img).animate({ "top": "-=10px", "left": "+=10px" }, "slow");
                });
                $(img).mouseout(function () {
                    $(img).animate({ "left": "-=10px", "top": "+=10px" }, "slow");
                });
  • You could provide some excerpt of the code you tried, maybe on Jsfiddle?

  • Hello Rhuan! Can you join HTML to complete the question? and how many elements are there? variable number?

  • I edited the question with an excerpt of what I’ve tried to do, if you need more information just ask. In case this code snippet is inside each, to scan the array of all images.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.