A
A
Altereyo2020-11-02 19:27:23
JavaScript
Altereyo, 2020-11-02 19:27:23

How to create "floating" blocks that can be "pushed" by the cursor?

I have about 15 different small-sized images, I need them not to be tied to a specific point on the page, but to be able to "float" around the entire limiter block.

I'm attaching a similar example below. But this is an example of interconnected blocks, and they react to the mouse only through dragging. And I need to be able to "push" them with the cursor back and forth.

https://codepen.io/xanisu/pen/egYRzO

I hope I made it clear.
I will be glad to tips in the form of special. libraries, examples or tips!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-11-02
@Altereyo

Well, what's so difficult?
You have an example of positioning such blocks.
Hang a handler on the mouseenter event, look at the mouse coordinates, the coordinates of the current block in it, and move it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question