How do I create floating blocks that can be pushed with the cursor?
-
I have about 15 different small pictures, I need them not to be attached to a specific point on the page, but to be able to "float" around the entire delimiter block.
I attach a somewhat similar example below. But this is an example of interconnected blocks, and they only react to the mouse through dragging. And I need to be able to "push" them back and forth with the cursor.
https://codepen.io/xanisu/pen/egYRzO
I hope I made it clear.
I would be glad to see tips in the form of specials. libraries, examples or tips!JavaScript Collin Rush, Sep 22, 2020 -
Well, what's so hard about it?
You have an example of positioning such blocks.
Hang up a handler on the mouseenter event, look at the coordinates of the mouse, the coordinates of the current block, and move it.Anonymous
2 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!