Resizable
It enables any DOM element to be resizable. With the cursor grab the right or bottom border and drag to the desired width or height.
Let’s create a demonstration page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>One Draggabletitle>
<link type="text/css" href="Scripts/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="Scripts/js/jquery-1.7.2.min.js">script>
<script type="text/javascript" src="Scripts/js/jquery-ui-1.8.20.custom.min.js">script>
<style type="text/css">
#resizable { width: 150px; height: 150px; padding: 0.5em; }
#resizable h3 { text-align: center; margin: 0; }
style>
<script type="text/javascript">
$(function () {
$("#resizable").resizable();
});
script>
head>
<body>
<form id="form1" runat="server">
<div id="resizable" class="ui-widget-content">
<h3 class="ui-widget-header">Resizableh3>
div>
form>
body>
html>
Nothing new here, let’s look it in bowser.
Selectable
It enables a DOM element (or group of elements) to be selectable. Draw a box with your cursor to select items. Hold down the Ctrl key to make multiple non-adjacent selections.
Let’s create a demonstration page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>One Draggabletitle>
<link type="text/css" href="Scripts/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="Stylesheet"/>
<script type="text/javascript" src="Scripts/js/jquery-1.7.2.min.js">script>
<script type="text/javascript" src="Scripts/js/jquery-ui-1.8.20.custom.min.js">script>
<style type="text/css">
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
style>
<script type="text/javascript">
$(function () {
$("#selectable").selectable();
});
script>
head>
<body>
<form id="form1" runat="server">
<ol id="selectable">
<li class="ui-widget-content">Item 1li>
<li class="ui-widget-content">Item 2li>
<li class="ui-widget-content">Item 3li>
<li class="ui-widget-content">Item 4li>
<li class="ui-widget-content">Item 5li>
<li class="ui-widget-content">Item 6li>
<li class="ui-widget-content">Item 7li>
ol>
form>
body>
html>
The jQuery UI Selectable plugin allows for elements to be selected by dragging a box (sometimes called a lasso) with the mouse over the elements. Also, elements can be selected by click or drag while holding the Ctrl/Meta key, allowing for multiple (non-contiguous) selections. Let’s look it in bowser.
Sortable
It enables a group of DOM elements to be sortable. Click on and drag an element to a new spot within the list, and the other items will adjust to fit. By default, sortable items share draggable properties.
Let’s create a demonstration page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>One Draggabletitle>
<link type="text/css" href="Scripts/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="Stylesheet"/>
<script type="text/javascript" src="Scripts/js/jquery-1.7.2.min.js">script>
<script type="text/javascript" src="Scripts/js/jquery-ui-1.8.20.custom.min.js">script>
<style type="text/css">
#sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em;height: 18px; }
#sortable li span { position: absolute; margin-left: -1.3em; }
style>
<script type="text/javascript">
$(function () {
$("#sortable").sortable();
$("#sortable").disableSelection();
});
script>
head>
<body>
<form id="form1" runat="server">
<ul id="sortable">
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 1li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 2li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 3li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 4li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 5li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 6li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s">span>Item 7li>
ul>
form>
body>
html>
The jQuery UI Sortable plugin makes selected elements sortable by dragging with the mouse.
All callbacks receive two arguments: The original browser event and a prepared ui object,
view below for a documentation of this object (if you name your second argument 'ui'):-
ui.helper - the current helper element (most often a clone of the item)
ui.position - current position of the helper
ui.offset - current absolute position of the helper
ui.item - the current dragged element
ui.placeholder - the placeholder (if you defined one)
ui.sender - the sortable where the item comes from (only exists if you move from one connected
list to another)
Let’s look it in bowser.
I hope you like it. Thanks.