Dude Dawg
Dude Dawg

Reputation: 1505

How to stop draggable from being dragged beyond a certain position?

I have a bar that's supposed to portray time and under this bar I've positioned two draggable markers, one of them signifying the starting time and the other signifying ending time. Unfortunately it would seem very crude if you could drag the ending time marker to the left of the starting time marker, because we must have start time <= end time. I have been trying this joern.zae... . Instead of minus equals I found out that I need to have just equals though. But the solution doesn't work, instead the draggable just flickers.

In summary, I need the draggable to stop when it reaches a certain position on the x axis.

Upvotes: 0

Views: 796

Answers (1)

Richard Neil Ilagan
Richard Neil Ilagan

Reputation: 14747

For draggables, you'd want to look at jQuery UI's samples on constraining movement.

From what it sounds like though, you're implementing a double handle slider bar, so you might want to look jQuery UI's slider demos instead.

Upvotes: 2

Related Questions