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!