Lio
Lio

Reputation: 1503

How to change position of jQuery Draggable Component by clicking (no dragging) on area?

I'm having a little trouble with jQuery UI Draggable component and hoping for your help.

I have a square box with 200x200px dimensions. In that box I have 100x100px of size draggable component, which is "snapped" to it's parent element.

When I drag that little box, it snaps by 100px to x or y axis.

What I wanna to do, is that when I click on some other place of that draggable area, the draggable component to go there.

Here's a Demo: http://jsbin.com/iPURAjUk/3/edit

As you can see, I have 4 places where that draggable component can be. By Default it's on 1st place, and I want to, if I click on 4th place, that component go to there.

I count find similar problem here or related methods on jquery ui documentation, so I was hoping you could help me.

Thank you!

Upvotes: 0

Views: 192

Answers (2)

Lio
Lio

Reputation: 1503

@gtournie

That's not exactly what I wanted.

But I figured it out by myself.

Here's the result of what I was trying to get. http://jsbin.com/iPURAjUk/8/edit?js,output

Upvotes: 0

gtournie
gtournie

Reputation: 4382

If you just need to click on areas, you don't really need of draggable.

Try this instead: http://jsbin.com/iPURAjUk/4/edit

Upvotes: 0

Related Questions