JQuery Easy UI Draggable (drag) component, jquerydraggable

Source: Internet
Author: User

JQuery Easy UI Draggable (drag) component, jquerydraggable

As mentioned above, jQuery EasyUI plug-in references are usually used in two ways (excluding the easyload Loading Method). Therefore, the Draggable component to be summarized in this article also has two loading methods:

(1) Use the class loading method:

<Div id = "box" class = "easyui-draggable" style = "width: 400px; height: 200px; background: red;">
Content
</Div>

(2) JS loading and calling

$ ('# Box'). draggable ();

As mentioned above, using the class attribute is not conducive to expanding other attributes of the component. Therefore, we use the JS call method, and the subsequent articles also use the JS call method.

This component has several attributes, methods, and trigger events, which are not listed here. They are all put in the sample code and annotated.

Example:

<! DOCTYPE html> 

Click to download source code


Kneeling a familiar jquery-ui-1820customminjs jquery ui jquery, how to set the Element Object to disable dragging draggable

You can write this line of code in its constructor, that is, it cannot be dragged for a lifetime of achievements.

The drag range of jQuery UI

You can set containment at the beginning.
$ (Function (){
$ ("# Draggable5"). draggable ({
'Containing': [x1, y1, x2, y2]
});
});

Called when x1, y1, x2, y2 changes
$ ("# Draggable5"). draggable ("option", "containment", [x1, y1, x2, y2]);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.