jquery Plugin (drag and drop)

Source: Internet
Author: User

Drag the plugin draggable function is to drag the bound element, when the jquery UI plug-in and the element binding, you can invoke the draggable() method to achieve the effects of various drag elements, the call format is as follows:

$(selector). draggable({options})

The options parameter is the configuration object at the time of the method invocation, and depending on the object you can set various drag effects, such as the "containment" property to specify the drag area, and the Axis property to set the coordinate direction when dragging.

<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml">    <Head>        <title>Drag Plugin</title>        <Linkhref= "Style.css"rel= "stylesheet"type= "Text/css" />        <Scriptsrc= "Http://www.imooc.com/data/jquery-1.8.2.min.js"type= "Text/javascript"></Script>        <Scriptsrc= "Http://www.imooc.com/data/jquery-ui-1.9.2.min.js"type= "Text/javascript"></Script>    </Head>        <Body>        <DivID= "Divtest">            <DivID= "X"class= "Drag">Drag along the x-axis</Div>            <DivID= "Y"class= "Drag">Drag along the y-axis</Div>        </Div>                <Scripttype= "Text/javascript">            $(function () {                $("#x"). Draggable ({containment:"Parent", Axis:"x"})                $("#y"). Draggable ({containment:"Parent", Axis:"y"})            }); </Script>    </Body></HTML>

jquery Plugin (drag and drop)

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.