Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-26-2011, 01:27 PM   PM User | #1
obenns
New Coder

 
Join Date: Nov 2011
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
obenns is an unknown quantity at this point
JQuery UI - Limiting move axis.

Hi all, using the Draggable feature: http://jqueryui.com/demos/draggable/

How can I limit the draggable div so it hits the sides of the container?

It states I can do this:

Quote:
Constrains dragging to either the horizontal (x) or vertical (y) axis. Possible values: 'x', 'y'.

Code examples

Initialize a draggable with the axis option specified.
$( ".selector" ).draggable({ axis: 'x' });
Get or set the axis option, after init.
//getter
var axis = $( ".selector" ).draggable( "option", "axis" );
//setter
$( ".selector" ).draggable( "option", "axis", 'x' );

But I don't really understand it. :S Not great with Javascript - so please make it simple!

Thanks.
obenns is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:45 PM.


Advertisement
Log in to turn off these ads.