Skip to content
/ DRAGELEM Public

A simple ES6 library that allows click/touch & drag on dom elements

License

Notifications You must be signed in to change notification settings

tevko/DRAGELEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

DRAGELEM

A simple ES6 library that allows click/touch & drag on dom elements. 541 bytes minified + gzipped.

TO USE


<div class=" _JS_zoomParent"> <!-- parent -->
	<div class="_JS_ZoomObj"> <!-- thing to drag -->
		<img class="_JS_ZoomImg" src="http://vignette2.wikia.nocookie.net/uncyclopedia/images/b/b4/Count-chocula.jpeg/revision/latest?cb=20110419172355"> <!-- contents -->
	</div>
</div>

const myDraggableElem = Object.create(dragElem);

myDraggableElem.inint(`.my-selector`);

Options

You can pass in a callback function.

const myDraggableElem = Object.create(dragElem);

myDraggableElem.init(`.my-selector`, e => {
  console.log(this, e);
});

Does it do the mobile things?

Yes. It does the mobile things.

Try it out

http://codepen.io/tevko/full/qZYwdG

About

A simple ES6 library that allows click/touch & drag on dom elements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published