UI Deploy

Curated, Short, Web UI Dev we Love.

Javascript - Draggable Elements

Draggable elements in javascript have been done hundreds of times before - from tutorials to packages to hacked up half working code files. But, hey, I have decided to throw my two cents in anyway - because we all know you wanted yet another option for dragging in javascript, right? Joking aside, what will will cover today are the detailed inner workings of a homegrown solution to draggable elements. Depending on your level of javascript knowledge, you might want to read two previous tutorials on this site: Javascript Objects - A Useful Example (which covers some basics about how objects work in javascript), and Javascript - Working With Events (which covers how to work with events and event objects). The techniques (and some of the code) from both of those articles will be used in this tutorial.

view post...

Advertisement