🔨 Move ANY element on page
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:
const MoveMaster = require('move-master'); // or: import MoveMaster from 'move-master';
const instance = MoveMaster({
target: /* HTMLElement */ logo,
hook: /* HTMLElement */ button // optional
});
// Later, to turn moving off:
instance.destroy();
With a <script> tag the function is available as window.MoveMaster. Moving works with a mouse, a pen and a finger (Pointer Events), also when the pointer leaves the element. Requiring the package on the server (SSR) is safe.
MoveMaster(options) returns { destroy() }.
Options:
target - HTMLElement which will be moved.hook - HTMLElement to grab (e.g. a title bar).
target.parent - ignored since version 3 (moves are tracked on the whole document), accepted for compatibility.The MIT License @ 2026