🔨 Move ANY element on page
_____ _____ _
| |___ _ _ ___| |___ ___| |_ ___ ___
| | | | . | | | -_| | | | .'|_ -| _| -_| _|
|_|_|_|___|\_/|___|_|_|_|__,|___|_| |___|_|
Click: https://codepen.io/piecioshka/full/dXAJdq/
We have for instance that structure in DOM:
<img id="logo" src="..." alt="Logo" />
Create in JavaScript file reference to that element:
var logo = document.querySelector('#logo');
Next, run that one line, to enable logo moving:
MoveMaster({
target: /* HTMLElement */ logo,
options: document.body,
hook: /* HTMLElement */ button
});
To enable moving on selected HTMLElement.
In settings:
target
- HTMLElement which will be movedparent
- HTMLElement of parent element, which will be calculate position. Defaultdocument.body
.hook
- HTMLElement of another element near moved object. Defaultnull
.
The MIT License @ 2014