mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable demos: Coding standards.
This commit is contained in:
parent
98fb8c8362
commit
6cf45dd25a
@ -1,35 +1,35 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Constrain movement</title>
|
<title>jQuery UI Draggable - Constrain movement</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
.draggable { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
.draggable { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
#draggable, #draggable2 { margin-bottom:20px; }
|
#draggable, #draggable2 { margin-bottom:20px; }
|
||||||
#draggable { cursor: n-resize; }
|
#draggable { cursor: n-resize; }
|
||||||
#draggable2 { cursor: e-resize; }
|
#draggable2 { cursor: e-resize; }
|
||||||
#containment-wrapper { width: 95%; height:150px; border:2px solid #ccc; padding: 10px;}
|
#containment-wrapper { width: 95%; height:150px; border:2px solid #ccc; padding: 10px; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ axis: 'y' });
|
$( "#draggable" ).draggable({ axis: "y" });
|
||||||
$("#draggable2").draggable({ axis: 'x' });
|
$( "#draggable2" ).draggable({ axis: "x" });
|
||||||
|
|
||||||
$("#draggable3").draggable({ containment: '#containment-wrapper', scroll: false });
|
|
||||||
$("#draggable4").draggable({ containment: '#demo-frame' });
|
|
||||||
$("#draggable5").draggable({ containment: 'parent' });
|
|
||||||
|
|
||||||
|
$( "#draggable3" ).draggable({ containment: "#containment-wrapper", scroll: false });
|
||||||
|
$( "#draggable4" ).draggable({ containment: "#demo-frame" });
|
||||||
|
$( "#draggable5" ).draggable({ containment: "parent" });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<h3 class="docs">Constrain movement along an axis:</h3>
|
<h3 class="docs">Constrain movement along an axis:</h3>
|
||||||
@ -59,12 +59,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Constrain the movement of each draggable by defining the boundaries of the draggable area. Set the <code>axis</code> option to limit the draggable's path to the x- or y-axis, or use the <code>containment</code> option to specify a parent DOM element or a jQuery selector, like 'document.'</p>
|
||||||
<p>
|
|
||||||
Constrain the movement of each draggable by defining the boundaries of the draggable area. Set the <code>axis</code> option to limit the draggable's path to the x- or y-axis, or use the <code>containment</code> option to specify a parent DOM element or a jQuery selector, like 'document.'
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Cursor style</title>
|
<title>jQuery UI Draggable - Cursor style</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ cursorAt: { cursor: 'move', top: 56, left: 56 } });
|
$( "#draggable" ).draggable({ cursorAt: { cursor: "move", top: 56, left: 56 } });
|
||||||
$("#draggable2").draggable({ cursorAt: { cursor: 'crosshair', top: -5, left: -5 } });
|
$( "#draggable2" ).draggable({ cursorAt: { cursor: "crosshair", top: -5, left: -5 } });
|
||||||
$("#draggable3").draggable({ cursorAt: { bottom: 0 } });
|
$( "#draggable3" ).draggable({ cursorAt: { bottom: 0 } });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="draggable" class="ui-widget-content">
|
<div id="draggable" class="ui-widget-content">
|
||||||
@ -38,12 +39,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Position the cursor while dragging the object. By default the cursor appears in the center of the dragged object; use the <code>cursorAt</code> option to specify another location relative to the draggable (specify a pixel value from the top, right, bottom, and/or left). Customize the cursor's appearance by supplying the <code>cursor</code> option with a valid CSS cursor value: default, move, pointer, crosshair, etc.</p>
|
||||||
<p>
|
|
||||||
Position the cursor while dragging the object. By default the cursor appears in the center of the dragged object; use the <code>cursorAt</code> option to specify another location relative to the draggable (specify a pixel value from the top, right, bottom, and/or left). Customize the cursor's appearance by supplying the <code>cursor</code> option with a valid CSS cursor value: default, move, pointer, crosshair, etc.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Default functionality</title>
|
<title>jQuery UI Draggable - Default functionality</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable { width: 150px; height: 150px; padding: 0.5em; }
|
#draggable { width: 150px; height: 150px; padding: 0.5em; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable();
|
$( "#draggable" ).draggable();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@ -29,12 +29,10 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Enable draggable functionality on any DOM element. Move the draggable object by clicking on it with the mouse and dragging it anywhere within the viewport.</p>
|
||||||
<p>
|
|
||||||
Enable draggable functionality on any DOM element. Move the draggable object by clicking on it with the mouse and dragging it anywhere within the viewport.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Delay start</title>
|
<title>jQuery UI Draggable - Delay start</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ distance: 20 });
|
$( "#draggable" ).draggable({ distance: 20 });
|
||||||
$("#draggable2").draggable({ delay: 1000 });
|
$( "#draggable2" ).draggable({ delay: 1000 });
|
||||||
$(".ui-draggable").disableSelection();
|
$( ".ui-draggable" ).disableSelection();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="draggable" class="ui-widget-content">
|
<div id="draggable" class="ui-widget-content">
|
||||||
@ -34,12 +35,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Delay the start of dragging for a number of milliseconds with the <code>delay</code> option; prevent dragging until the cursor is held down and dragged a specifed number of pixels with the <code>distance</code> option. </p>
|
||||||
<p>
|
|
||||||
Delay the start of dragging for a number of milliseconds with the <code>delay</code> option; prevent dragging until the cursor is held down and dragged a specifed number of pixels with the <code>distance</code> option.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,51 +1,53 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Events</title>
|
<title>jQuery UI Draggable - Events</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable { width: 16em; padding: 0 1em; }
|
#draggable { width: 16em; padding: 0 1em; }
|
||||||
#draggable ul li { margin: 1em 0; padding: 0.5em 0; } * html #draggable ul li { height: 1%; }
|
#draggable ul li { margin: 1em 0; padding: 0.5em 0; } * html #draggable ul li { height: 1%; }
|
||||||
#draggable ul li span.ui-icon { float: left; }
|
#draggable ul li span.ui-icon { float: left; }
|
||||||
#draggable ul li span.count { font-weight: bold; }
|
#draggable ul li span.count { font-weight: bold; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
var $start_counter = $('#event-start'), $drag_counter = $('#event-drag'), $stop_counter = $('#event-stop');
|
var $start_counter = $( "#event-start" ),
|
||||||
var counts = [0,0,0];
|
$drag_counter = $( "#event-drag" ),
|
||||||
|
$stop_counter = $( "#event-stop" ),
|
||||||
|
counts = [ 0, 0, 0 ];
|
||||||
|
|
||||||
$("#draggable").draggable({
|
$( "#draggable" ).draggable({
|
||||||
start: function() {
|
start: function() {
|
||||||
counts[0]++;
|
counts[ 0 ]++;
|
||||||
updateCounterStatus($start_counter,counts[0]);
|
updateCounterStatus( $start_counter, counts[ 0 ] );
|
||||||
},
|
},
|
||||||
drag: function() {
|
drag: function() {
|
||||||
counts[1]++;
|
counts[ 1 ]++;
|
||||||
updateCounterStatus($drag_counter,counts[1]);
|
updateCounterStatus( $drag_counter, counts[ 1 ] );
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
counts[2]++;
|
counts[ 2 ]++;
|
||||||
updateCounterStatus($stop_counter,counts[2]);
|
updateCounterStatus( $stop_counter, counts[ 2 ] );
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateCounterStatus($event_counter,new_count) {
|
function updateCounterStatus( $event_counter, new_count ) {
|
||||||
// first update the status visually...
|
// first update the status visually...
|
||||||
if (!$event_counter.hasClass('ui-state-hover')) {
|
if ( !$event_counter.hasClass( "ui-state-hover" ) ) {
|
||||||
$event_counter.addClass('ui-state-hover')
|
$event_counter.addClass( "ui-state-hover" )
|
||||||
.siblings().removeClass('ui-state-hover');
|
.siblings().removeClass( "ui-state-hover" );
|
||||||
}
|
}
|
||||||
// ...then update the numbers
|
// ...then update the numbers
|
||||||
$('span.count',$event_counter).text(new_count);
|
$( "span.count", $event_counter ).text( new_count );
|
||||||
}
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -65,12 +67,10 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Layer functionality onto the draggable using the <code>start</code>, <code>drag</code>, and <code>stop</code> events. Start is fired at the start of the drag; drag during the drag; and stop when dragging stops.</p>
|
||||||
<p>
|
|
||||||
Layer functionality onto the draggable using the <code>start</code>, <code>drag</code>, and <code>stop</code> events. Start is fired at the start of the drag; drag during the drag; and stop when dragging stops.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Handles</title>
|
<title>jQuery UI Draggable - Handles</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
#draggable p { cursor: move; }
|
#draggable p { cursor: move; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ handle: 'p' });
|
$( "#draggable" ).draggable({ handle: "p" });
|
||||||
$("#draggable2").draggable({ cancel: "p.ui-widget-header" });
|
$( "#draggable2" ).draggable({ cancel: "p.ui-widget-header" });
|
||||||
$("div, p").disableSelection();
|
$( "div, p" ).disableSelection();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="draggable" class="ui-widget-content">
|
<div id="draggable" class="ui-widget-content">
|
||||||
@ -38,11 +39,12 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
<div class="demo-description">
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="demo-description">
|
||||||
<p>Allow dragging only when the cursor is over a specific part of the draggable. Use the <code>handle</code> option to specify the jQuery selector of an element (or group of elements) used to drag the object.</p>
|
<p>Allow dragging only when the cursor is over a specific part of the draggable. Use the <code>handle</code> option to specify the jQuery selector of an element (or group of elements) used to drag the object.</p>
|
||||||
<p>Or prevent dragging when the cursor is over a specific element (or group of elements) within the draggable. Use the <code>cancel</code> option to specify a jQuery selector over which to "cancel" draggable functionality.</p>
|
<p>Or prevent dragging when the cursor is over a specific element (or group of elements) within the draggable. Use the <code>cancel</code> option to specify a jQuery selector over which to "cancel" draggable functionality.</p>
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable Demos</title>
|
<title>jQuery UI Draggable Demos</title>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Revert position</title>
|
<title>jQuery UI Draggable - Revert position</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ revert: true });
|
$( "#draggable" ).draggable({ revert: true });
|
||||||
$("#draggable2").draggable({ revert: true, helper: 'clone' });
|
$( "#draggable2" ).draggable({ revert: true, helper: "clone" });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="draggable" class="ui-widget-content">
|
<div id="draggable" class="ui-widget-content">
|
||||||
@ -33,12 +34,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Return the draggable (or it's helper) to its original location when dragging stops with the boolean <code>revert</code> option.</p>
|
||||||
<p>
|
|
||||||
Return the draggable (or it's helper) to its original location when dragging stops with the boolean <code>revert</code> option.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Auto-scroll</title>
|
<title>jQuery UI Draggable - Auto-scroll</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ scroll: true });
|
$( "#draggable" ).draggable({ scroll: true });
|
||||||
$("#draggable2").draggable({ scroll: true, scrollSensitivity: 100 });
|
$( "#draggable2" ).draggable({ scroll: true, scrollSensitivity: 100 });
|
||||||
$("#draggable3").draggable({ scroll: true, scrollSpeed: 100 });
|
$( "#draggable3" ).draggable({ scroll: true, scrollSpeed: 100 });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="draggable" class="ui-widget-content">
|
<div id="draggable" class="ui-widget-content">
|
||||||
@ -40,12 +41,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Automatically scroll the document when the draggable is moved beyond the viewport. Set the <code>scroll</code> option to true to enable auto-scrolling, and fine-tune when scrolling is triggered and its speed with the <code>scrollSensitivity</code> and <code>scrollSpeed</code> options.</p>
|
||||||
<p>
|
|
||||||
Automatically scroll the document when the draggable is moved beyond the viewport. Set the <code>scroll</code> option to true to enable auto-scrolling, and fine-tune when scrolling is triggered and its speed with the <code>scrollSensitivity</code> and <code>scrollSpeed</code> options.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,31 +1,32 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Snap to element or grid</title>
|
<title>jQuery UI Draggable - Snap to element or grid</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
.draggable { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; }
|
.draggable { width: 90px; height: 80px; padding: 5px; float: left; margin: 0 10px 10px 0; font-size: .9em; }
|
||||||
.ui-widget-header p, .ui-widget-content p { margin: 0; }
|
.ui-widget-header p, .ui-widget-content p { margin: 0; }
|
||||||
#snaptarget { height: 140px; }
|
#snaptarget { height: 140px; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ snap: true });
|
$( "#draggable" ).draggable({ snap: true });
|
||||||
$("#draggable2").draggable({ snap: '.ui-widget-header' });
|
$( "#draggable2" ).draggable({ snap: ".ui-widget-header" });
|
||||||
$("#draggable3").draggable({ snap: '.ui-widget-header', snapMode: 'outer' });
|
$( "#draggable3" ).draggable({ snap: ".ui-widget-header", snapMode: "outer" });
|
||||||
$("#draggable4").draggable({ grid: [20,20] });
|
$( "#draggable4" ).draggable({ grid: [ 20,20 ] });
|
||||||
$("#draggable5").draggable({ grid: [80, 80] });
|
$( "#draggable5" ).draggable({ grid: [ 80, 80 ] });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<div id="snaptarget" class="ui-widget-header">
|
<div id="snaptarget" class="ui-widget-header">
|
||||||
@ -56,15 +57,12 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
|
||||||
<p>Snap the draggable to the inner or outer boundaries of a DOM element. Use the <code>snap</code>, <code>snapMode</code> (inner, outer, both), and <code>snapTolerance</code> (distance in pixels the draggable must be from the element when snapping is invoked) options. </p>
|
<p>Snap the draggable to the inner or outer boundaries of a DOM element. Use the <code>snap</code>, <code>snapMode</code> (inner, outer, both), and <code>snapTolerance</code> (distance in pixels the draggable must be from the element when snapping is invoked) options. </p>
|
||||||
|
|
||||||
<p>Or snap the draggable to a grid. Set the dimensions of grid cells (height and width in pixels) with the <code>grid</code> option.</p>
|
<p>Or snap the draggable to a grid. Set the dimensions of grid cells (height and width in pixels) with the <code>grid</code> option.</p>
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,35 +1,36 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable + Sortable</title>
|
<title>jQuery UI Draggable + Sortable</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
|
<script src="../../ui/jquery.ui.sortable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
.demo ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 10px; }
|
.demo ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 10px; }
|
||||||
.demo li { margin: 5px; padding: 5px; width: 150px; }
|
.demo li { margin: 5px; padding: 5px; width: 150px; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#sortable").sortable({
|
$( "#sortable" ).sortable({
|
||||||
revert: true
|
revert: true
|
||||||
});
|
});
|
||||||
$("#draggable").draggable({
|
$( "#draggable" ).draggable({
|
||||||
connectToSortable: '#sortable',
|
connectToSortable: "#sortable",
|
||||||
helper: 'clone',
|
helper: "clone",
|
||||||
revert: 'invalid'
|
revert: "invalid"
|
||||||
});
|
});
|
||||||
$("ul, li").disableSelection();
|
$( "ul, li" ).disableSelection();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@ -46,12 +47,11 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
<p>Draggables are built to interact seamlessly with <a href="#">sortables</a>.</p>
|
||||||
<p>
|
|
||||||
Draggables are built to interact seamlessly with <a href="#">sortables</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,37 +1,38 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="utf-8">
|
||||||
<title>jQuery UI Draggable - Visual feedback</title>
|
<title>jQuery UI Draggable - Visual feedback</title>
|
||||||
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
||||||
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
|
<script src="../../jquery-1.4.2.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
|
<script src="../../ui/jquery.ui.core.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
|
<script src="../../ui/jquery.ui.widget.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
|
<script src="../../ui/jquery.ui.mouse.js"></script>
|
||||||
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
|
<script src="../../ui/jquery.ui.draggable.js"></script>
|
||||||
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
<link rel="stylesheet" href="../demos.css">
|
||||||
<style type="text/css">
|
<style>
|
||||||
#draggable, #draggable2, #draggable3, #set div { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
#draggable, #draggable2, #draggable3, #set div { width: 90px; height: 90px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
|
||||||
#draggable, #draggable2, #draggable3 { margin-bottom:20px; }
|
#draggable, #draggable2, #draggable3 { margin-bottom:20px; }
|
||||||
#set { clear:both; float:left; width: 368px; height: 120px; }
|
#set { clear:both; float:left; width: 368px; height: 120px; }
|
||||||
p { clear:both; margin:0; padding:1em 0; }
|
p { clear:both; margin:0; padding:1em 0; }
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#draggable").draggable({ helper: 'original' });
|
$( "#draggable" ).draggable({ helper: "original" });
|
||||||
$("#draggable2").draggable({ opacity: 0.7, helper: 'clone' });
|
$( "#draggable2" ).draggable({ opacity: 0.7, helper: "clone" });
|
||||||
$("#draggable3").draggable({
|
$( "#draggable3" ).draggable({
|
||||||
cursor: 'move',
|
cursor: "move",
|
||||||
cursorAt: { top: -12, left: -20 },
|
cursorAt: { top: -12, left: -20 },
|
||||||
helper: function(event) {
|
helper: function( event ) {
|
||||||
return $('<div class="ui-widget-header">I\'m a custom helper</div>');
|
return $( "<div class='ui-widget-header'>I'm a custom helper</div>" );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#set div").draggable({ stack: '#set div' });
|
$( "#set div" ).draggable({ stack: "#set div" });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="demo">
|
<div class="demo">
|
||||||
|
|
||||||
<h3 class="docs">With helpers:</h3>
|
<h3 class="docs">With helpers:</h3>
|
||||||
@ -65,12 +66,12 @@
|
|||||||
|
|
||||||
</div><!-- End demo -->
|
</div><!-- End demo -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="demo-description">
|
<div class="demo-description">
|
||||||
|
|
||||||
<p>Provide feedback to users as they drag an object in the form of a helper. The <code>helper</code> option accepts the values 'original' (the draggable object moves with the cursor), 'clone' (a duplicate of the draggable moves with the cursor), or a function that returns a DOM element (that element is shown near the cursor during drag). Control the helper's transparency with the <code>opacity</code> option.</p>
|
<p>Provide feedback to users as they drag an object in the form of a helper. The <code>helper</code> option accepts the values 'original' (the draggable object moves with the cursor), 'clone' (a duplicate of the draggable moves with the cursor), or a function that returns a DOM element (that element is shown near the cursor during drag). Control the helper's transparency with the <code>opacity</code> option.</p>
|
||||||
|
|
||||||
<p>To clarify which draggable is in play, bring the draggable in motion to front. Use the <code>zIndex</code> option to set a higher z-index for the helper, if in play, or use the <code>stack</code> option to ensure that the last item dragged will appear on top of others in the same group on drag stop.</p>
|
<p>To clarify which draggable is in play, bring the draggable in motion to front. Use the <code>zIndex</code> option to set a higher z-index for the helper, if in play, or use the <code>stack</code> option to ensure that the last item dragged will appear on top of others in the same group on drag stop.</p>
|
||||||
|
|
||||||
</div><!-- End demo-description -->
|
</div><!-- End demo-description -->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user