Jquery-draggable parameter Introduction
Default setting Value:
$.extend ($.ui.draggable, {
Version: "1.7.1″,
Eventprefix: "Drag",
Defaults: {
Addclasses:true,
AppendTo: "Parent",
Axis:false,
Cancel: ": Input,option",
Connecttosortable:false,
Containment:false,
Cursor: "Auto",
Cursorat:false,
delay:0,
Distance:1,
Grid:false,
Handle:false,
Helper: "Original",
Iframefix:false,
Opacity:false,
Refreshpositions:false,
Revert:false,
REVERTDURATION:500,
Scope: "Default",
Scroll:true,
SCROLLSENSITIVITY:20,
SCROLLSPEED:20,
Snap:false,
SnapMode: "Both",
SNAPTOLERANCE:20,
Stack:false,
Zindex:false
}
});
============================================================
Default:
$ ("#draggable"). Draggable ();
============================================================
Events
var $start _counter = $ (' #event-start '), $drag _counter = $ (' #event-drag '), $stop _counter = $ (' #event-stop ');
var counts = [0,0,0];
$ ("#draggable"). Draggable ({
Start:function () {
counts[0]++;
Updatecounterstatus ($start _counter,counts[0]);
},
Drag:function () {
counts[1]++;
Updatecounterstatus ($drag _counter,counts[1]);
},
Stop:function () {
counts[2]++;
Updatecounterstatus ($stop _counter,counts[2]);
}
});
});
function Updatecounterstatus ($event _counter,new_count) {
First update the status visually ...
if (! $event _counter.hasclass (' Ui-state-hover ')) {
$event _counter.addclass (' Ui-state-hover ')
. siblings (). Removeclass (' Ui-state-hover ');
}
... then update the numbers
$ (' Span.count ', $event _counter). Text (New_count);
============================================================
Constrain-movement (Restricted range movement):
$ ("#draggable"). Draggable ({axis: ' y '}); Limit Y-axis
$ ("#draggable2 ″). Draggable ({axis: ' x '}); Limit X-axis
$ ("#draggable3 ″). Draggable ({containment: ' #containment-wrapper ', scroll:false}); Scroll bar does not appear
$ ("#draggable4 ″). Draggable ({containment: ' #demo-frame '});
$ ("#draggable5 ″). Draggable ({containment: ' parent '}); Restrict in the parent frame
============================================================
Delay-start (delayed Move):
$ ("#draggable"). Draggable ({distance:20}); Move 20 pixels to start dragging
$ ("#draggable2 ″). draggable ({delay:1000});//start dragging after 1 seconds delay
============================================================
Snap-to (Adsorption movement):
$ ("#draggable"). Draggable ({snap:true}); By default, adsorption in any way
$ ("#draggable2 ″). Draggable ({snap: '. Ui-widget-header '}); Adsorption on the inner and outer diameter of an element
$ ("#draggable3 ″). Draggable ({snap: '. Ui-widget-header ', SnapMode: ' outer '}); To an element of the outside diameter adsorption, adsorption mode: Ben on the bottom suction, the bottom suction on it. Inner diameter adsorption: inner, adsorption method: opposite
$ ("#draggable4 ″). draggable ({grid: [20,20]});//move at a certain distance
$ ("#draggable5 ″). draggable ({grid: [80, 80]});
============================================================
Scroll
$ ("#draggable"). Draggable ({scroll:true});
$ ("#draggable2 ″). draggable ({scroll:true, scrollsensitivity:100}); scroll bar Sensitivity
$ ("#draggable3 ″). draggable ({scroll:true, scrollspeed:100}); Scrolling speed
============================================================
Revert position (revert to original location):
$ ("#draggable"). Draggable ({revert:true}); Revert:true set to revert to location
$ ("#draggable2 ″). draggable ({revert:true, helper: ' Clone '}); Helper: ' Clone ' copy drag
============================================================
Visualfeedback (visual effects):
$ ("#draggable"). Draggable ({helper: ' original '}); Settings do not replicate (Initialize settings)
$ ("#draggable2 ″). draggable ({opacity:0.7, helper: ' Clone '}); Opacity set transparency, and clone elements
$ ("#draggable3 ″). draggable ({
Cursor: ' move ',//Set mouse graphic
Cursorat: {top: -12, left:-20},//position location coordinate setting
Helper:function (event) {
return $ (' <div class= "Ui-widget-header" >i\ ' m a custom helper</div> ');
}//new hint element, set it to position the location value with the mouse
});
$ ("#set div"). Draggable ({stack: {group: ' #set div ', min:-1}});//Group settings drag, and the last added element overlays the top of the group. Ideal for making a wishing board effect.
============================================================
Drag handle (drag point settings):
$ ("#draggable"). Draggable ({handle: ' P '}); Handle setting implementation Drag position
$ ("#draggable2 ″). Draggable ({cancel:" P.ui-widget-header "}); Cancel to set limit drag position
============================================================
Cursor style (mouse style):
$ ("#draggable"). Draggable ({cursorat: {cursor: ' move ', top:56, left:56}}); Cursor set mouse style, top, left, right, bottom sets the anchor point of the element relative to the mouse
$ ("#draggable2 ″). Draggable ({cursorat: {cursor: ' crosshair ', top: -5, Left:-5}});
$ ("#draggable3 ″). Draggable ({cursorat: {bottom:0}});
===========================================================
Cursor style (mouse style):
$ ("#draggable"). Draggable ({cursorat: {cursor: ' move ', top:56, left:56}}); Cursor set mouse style, top, left, right, bottom sets the anchor point of the element relative to the mouse
============================================================
Draggable+sortable:
$ ("#sortable"). Sortable ({
Revert:true
});
$ ("#draggable"). Draggable ({
Connecttosortable: ' #sortable ',//Set Drag to join the other list
Helper: ' Clone ',
revert: ' Invalid '
});
Reprint: http://blog.sina.com.cn/s/blog_48474ade0100exfg.html
Detailed parameter explanation of droppable