Backdrop is a simple JavaScript module to preload an image and gracefully apply it as the background of a node
in the page. There are three parameters in the object's constructor configuration, although only the first is required:
node
src
| srcset
id
(optional)`backdrop`
if none provided)styles
(optional)position
, repeat
, size
) and the respective values that should be applied to the backdropThree custom events are fired:
start
end
error
An example implementation follows:
var dropper = new Backdrop({}); drop.on('end', function(url) { window.console.log('dropped', url); }); dropper.drop({srcset: 'https://path/to/image.jpg'});