jquery UI draggable Learning

Source: Internet
Author: User

The draggable in the jquery UI component is a powerful tool that can drag elements in various ways. In its official website http://jqueryui.com/demos/draggable/only some parameters and events were introduced, there is no specific examples to explain. Below I will explain the common use of a higher number of options:

1.axis: Sets the direction of the drag, with a value of ' X ', ' Y ' two. X means drag at the horizontal position, and y means drag in the vertical direction.

2.cancel: Setting prevents dragging on an element. This parameter can optionally drag some elements, or you can loop through the elements and stop dragging.

3.containment: Restrict what frames to drag. The commonly used value is parent, and restrictions can only be dragged in the parent frame. For a frame made up of multiple div, you can use this parameter to restrict the range of the drag only in the parent frame without affecting elements outside of the parent frame.

4.connectToSortable: This parameter can be used in conjunction with sortable in the jquery UI. As the name suggests, dragging related elements can be sorted to adjust the position between elements.

5.drag Event: The set callback function is invoked during the drag process. So we can do some related elements in this callback function, such as dragging the color and brightness of some elements to adjust to achieve a flickering effect.

6.start Event: The event that is triggered when the drag is started. You can then initialize the data in this event that only needs to be displayed in the drag process to reduce the pressure on the database without opening the page.

7.stop Event: The event that ends the drag action, as opposed to the start event. Of course, some extra data can be erased in this event.

Some of the parameters and methods commonly used in the application are these, which will increase and subtract some parameters according to the change of requirement. Technology is always in the second place, the business is the first. There is a business to determine the technology.

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.