Draggable (drag) component

Source: Internet
Author: User

1 A. Load mode 2  //34 <div id= "box" class= "easyui-draggable" style= " width:400px;height:200px;background:red; " > Content Section </div>567//JS load call 89  $ (' #box '). draggable ();
Load Mode

Property List

property settings

$ (' #box '). Draggable ({

Revert:true,

Cursor: ' Text ',

Handle: ' #pox ',

Disabled:false,

EDGE:50,

Axis: ' V ',

Proxy: ' Clone ',

Deltax:10,

Deltay:10,

Proxy:function (source) {

var p = $ (' <div style= "border:1px solid #ccc; width:400px;height:200px;" ></div> ');

p.html (source). HTML ()). AppendTo (' body ');

return p;

},

});

Event List

$ (' #box '). Draggable ({

Onbeforedrag:function (e) {

Alert (' Drag before triggering! ‘);

return false;

},


Onstartdrag:function (e) {

Alert (' Trigger when dragging! ‘);

},


Ondrag:function (e) {

Alert (' Trigger during drag! ‘);

},

Onstopdrag:function (e) {

Alert (' Trigger when drag is stopped! ‘);

},

});

Draggable method

Return Property Object

Console.log ($ (' #box '). draggable (' options '));

Returns the agent element

Onstartdrag:function (e) {

Console.log ($ (' #box '). Draggable (' proxy '));

},

Prohibit dragging

$ (' #box '). Draggable (' disable ');

Allow drag and drop

$ (' #box '). Draggable (' Enable ');


PS: We can use $.fn.draggable.defaults to override the default value object.

$.fn.draggable.defaults.cursor = ' text ';

Draggable (drag) component

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.