Draggable: Update to demos to use AMD

Ref #10119
This commit is contained in:
Alexander Schmitz 2015-06-30 17:12:39 -04:00
parent f18ec88ea8
commit 41b5b2d7a9
10 changed files with 20 additions and 81 deletions

View File

@ -4,11 +4,6 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Constrain movement</title> <title>jQuery UI Draggable - Constrain movement</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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; }
@ -18,14 +13,13 @@
#containment-wrapper { width: 95%; height:150px; border:2px solid #ccc; padding: 10px; } #containment-wrapper { width: 95%; height:150px; border:2px solid #ccc; padding: 10px; }
h3 { clear: left; } h3 { clear: left; }
</style> </style>
<script> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#draggable" ).draggable({ axis: "y" }); $( "#draggable" ).draggable({ axis: "y" });
$( "#draggable2" ).draggable({ axis: "x" }); $( "#draggable2" ).draggable({ axis: "x" });
$( "#draggable3" ).draggable({ containment: "#containment-wrapper", scroll: false }); $( "#draggable3" ).draggable({ containment: "#containment-wrapper", scroll: false });
$( "#draggable5" ).draggable({ containment: "parent" }); $( "#draggable5" ).draggable({ containment: "parent" });
});
</script> </script>
</head> </head>
<body> <body>

View File

@ -4,21 +4,15 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Cursor style</title> <title>jQuery UI Draggable - Cursor style</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#draggable" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } }); $( "#draggable" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
$( "#draggable2" ).draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } }); $( "#draggable2" ).draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } });
$( "#draggable3" ).draggable({ cursorAt: { bottom: 0 } }); $( "#draggable3" ).draggable({ cursorAt: { bottom: 0 } });
});
</script> </script>
</head> </head>
<body> <body>

View File

@ -4,19 +4,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Default functionality</title> <title>jQuery UI Draggable - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <style>
#draggable { width: 150px; height: 150px; padding: 0.5em; } #draggable { width: 150px; height: 150px; padding: 0.5em; }
</style> </style>
<script> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#draggable" ).draggable(); $( "#draggable" ).draggable();
});
</script> </script>
</head> </head>
<body> <body>

View File

@ -4,11 +4,6 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Events</title> <title>jQuery UI Draggable - Events</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <style>
#draggable { width: 16em; padding: 0 1em; } #draggable { width: 16em; padding: 0 1em; }
@ -16,8 +11,8 @@
#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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
var $start_counter = $( "#event-start" ), var $start_counter = $( "#event-start" ),
$drag_counter = $( "#event-drag" ), $drag_counter = $( "#event-drag" ),
$stop_counter = $( "#event-stop" ), $stop_counter = $( "#event-stop" ),
@ -47,7 +42,6 @@
// ...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>

View File

@ -4,22 +4,16 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Handles</title> <title>jQuery UI Draggable - Handles</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#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>

View File

@ -4,20 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Revert position</title> <title>jQuery UI Draggable - Revert position</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#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>

View File

@ -4,21 +4,15 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Auto-scroll</title> <title>jQuery UI Draggable - Auto-scroll</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#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>

View File

@ -4,25 +4,19 @@
<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 rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#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>

View File

@ -4,19 +4,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable + Sortable</title> <title>jQuery UI Draggable + Sortable</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<script src="../../ui/sortable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <style>
ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 10px; } ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 10px; }
li { margin: 5px; padding: 5px; width: 150px; } li { margin: 5px; padding: 5px; width: 150px; }
</style> </style>
<script> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js" data-modules="sortable">
$( "#sortable" ).sortable({ $( "#sortable" ).sortable({
revert: true revert: true
}); });
@ -26,7 +20,6 @@
revert: "invalid" revert: "invalid"
}); });
$( "ul, li" ).disableSelection(); $( "ul, li" ).disableSelection();
});
</script> </script>
</head> </head>
<body> <body>

View File

@ -4,11 +4,6 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>jQuery UI Draggable - Visual feedback</title> <title>jQuery UI Draggable - Visual feedback</title>
<link rel="stylesheet" href="../../themes/base/all.css"> <link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/mouse.js"></script>
<script src="../../ui/draggable.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <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; }
@ -16,8 +11,8 @@
#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> <script src="../../external/requirejs/require.js"></script>
$(function() { <script src="../bootstrap.js">
$( "#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({
@ -28,7 +23,6 @@
} }
}); });
$( "#set div" ).draggable({ stack: "#set div" }); $( "#set div" ).draggable({ stack: "#set div" });
});
</script> </script>
</head> </head>
<body> <body>