JQuery Easy UI Draggable (drag) Component

Source: Internet
Author: User

JQuery Easy UI Draggable (drag) Component

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:


Content

(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:

JQuery Easy UI
 <Script type = "text/javascript" src = "easyui/jquery. min. js "> </script> <script type =" text/javascript "src =" easyui/jquery. easyui. min. js "> </script> <script type =" text/javascript "src =" easyui/locale/easyui-lang-zh_CN.js "> </script>
 
 <Script> $ (function () {$. fn. draggable. defaults. cursor = 'text'; // ***** use this method to override the default value $ ('# box '). draggable ({// revert: true, the default value is false. When the value is set to true, the start position is returned after the drag ends. // cursor: 'text ', define the pointer style when dragging. // handle: '# pox'. The handle used to start dragging is where you can drag the pointer. The parameter is a JQ selector // disabled: true, when it is set to true, do not drag // edge: 0, // axis: 'V', do not write: any drag value is v: vertical drag value is h: horizontal drag // proxy: 'clone '. When 'clone' is used, clone an alternative element and drag it. If a function is specified, you can customize the substitution element. DeltaX: 50, // The dragged element corresponds to the current cursor position XdeltaY: 50, // The dragged element corresponds to the current cursor position Yproxy: function (source) {var p = {('{}p.html({(source}.html ()). appendTo ('body'); return p;}/** trigger event: onBeforeDrag: function (e) {alert ('trigger before dragging! ') ;}, OnBeforeDrag: function (e) {// return false ;}, onStartDrag: function (e) {alert ('drag to start triggering! '); Console. log ($ ('# box '). draggable ('proxy');}, onDrag: function (e) {// alert ('triggered during dragging! ') ;}, OnStopDrag: function (e) {alert (' triggered after the drag ends! ');} */}); // $ (' # Box '). draggable ('disable'); // drag prohibited // $ ('# box '). draggable ('enable'); // you can drag it. // alert ($ ('# box '). draggable ('options'); // returns object attributes}); </script>Content

Click to download source code

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.