You can define JavaScript functions in a post:
Or include them in the template, as I did a heavily modified version* of Mike Hall's generic drag.
Draggable
Handle
Draggable by handle
H Slider
V Slider
* And more to come, basically slimming towards the5k.org - type minimalism. I elimated browser detection in favor of function detection, and all browsers seem to have document.documentElement.scrollLeft,scrollTop, etc. window is mutable because that's where variables are stored. Mike Halls' was the most minimal and generic one I found (there is also Dom-Drag and WZ drag drop lib), but not good enough for me. I want something with one-letter variables, no unnecessary objects or tests (for example, the two else statements in my code are unnecessary, as IE won't balk at setting A to undefined B), spaces and tabs and returns stripped, something I could pop into a post. By the way, to make Mike Hall's generic drag into a slider, simply comment out either the x= or y= statements in dragGo . To set bounds, put a min or max or both in the same statements.
No comments:
Post a Comment