JavaScript-based on the jquery UI, _javascript tips for dragging effects in selected areas

Source: Internet
Author: User

One, the effect shows

Ordinary three Div

Drag the mouse to select the effect

Select all of the DIV

This does not seem to see the effect, it does not matter, we have a magic gif animation, to a whole animation effect feel.

Second, code implementation

The whole code is not difficult, need to use a blogger's own encapsulated JS file.

Areaselect.js

Given the size of the code and the lack of code folding, here's a filename. And so the blogger took the time to open it to GitHub, of course, the need for friends can also contact the blogger directly, bloggers free to provide!

After this JS is introduced, you will also need to refer to jquery and jquery UI related files.

<script src= "Scripts/jquery-1.10.2.js" ></script>
<script src= "Content/jquery-ui-1.11.4.custom" /jquery-ui.js "></script>
<link href=" Content/jquery-ui-1.11.4.custom/jquery-ui.min.css "rel=" Stylesheet "/>
<script src=" Scripts/common/selectarea.js "></script>

Because after the file, then the rest is HTML and JS initialization

<body>
<div id= "Divcenter" >
<div id= "Div1" style= "Position:absolute;width:200px;height" : 150px;left:200px;top:50px;cursor:pointer; " >div2</div>
<div id= "Div2" style= "position:absolute;width:200px;height:150px;left:450px;top : 200px;cursor:pointer; " >div2</div>
<div id= "Div3" style= "position:absolute;width:200px;height:150px;left:700px;top : 390px;cursor:pointer; " >div3</div>
</div>
</body>
$ (function () {
$ ("#divCenter div"). Draggable ({
scope: "Plant",
start:function () {
startmove ();
},
Drag:function (event, UI) {
Moveselectdiv (event, UI, $ (this). attr ("id"));
Oregionselect = new Regionselect ({
region: ' #divCenter div ',
selectedclass: ' seled ',
parentid: " Divcenter "
});
Oregionselect.select ();
});

The above is a small set to introduce JavaScript based on the jquery UI implementation of the selection area drag effect, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.