aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2010-04-08 23:03:35 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2010-04-08 23:03:35 +0200
commit9230b7263b90dfc3fcb4a309b549332dee6dcba4 (patch)
tree9e8ea3844386b841b10c521ff3fe5ab0c4c1e43b /demos
parent1a89b6ee2f9f02fd92d9ec3ee663b7dd237d3d15 (diff)
parentffc29bba052e4bc8b84e4c2e16036140148b6f9c (diff)
downloadjquery-ui-9230b7263b90dfc3fcb4a309b549332dee6dcba4.tar.gz
jquery-ui-9230b7263b90dfc3fcb4a309b549332dee6dcba4.zip
Merge branch 'master' into tooltip
Diffstat (limited to 'demos')
-rw-r--r--demos/autocomplete/combobox.html19
-rw-r--r--demos/autocomplete/index.html1
-rw-r--r--demos/button/splitbutton.html28
-rw-r--r--demos/droppable/index.html1
-rw-r--r--demos/droppable/shopping-cart.html101
-rw-r--r--demos/index.html2
-rw-r--r--demos/tabs/cookie.html57
-rw-r--r--demos/tabs/index.html1
-rw-r--r--demos/tooltip/default.html48
-rw-r--r--demos/tooltip/forms.html69
-rw-r--r--demos/tooltip/index.html21
-rw-r--r--demos/tooltip/tracking.html65
12 files changed, 188 insertions, 225 deletions
diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html
index 4c6b656a1..3001f7d17 100644
--- a/demos/autocomplete/combobox.html
+++ b/demos/autocomplete/combobox.html
@@ -30,24 +30,23 @@
var matcher = new RegExp(request.term, "i");
response(select.children("option").map(function() {
var text = $(this).text();
- if (!request.term || matcher.test(text))
+ if (this.value && (!request.term || matcher.test(text)))
return {
- id: $(this).val(),
+ id: this.value,
label: text.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(request.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"),
value: text
};
}));
},
delay: 0,
- select: function(e, ui) {
+ change: function(event, ui) {
if (!ui.item) {
// remove invalid value, as it didn't match anything
$(this).val("");
return false;
}
- $(this).focus();
select.val(ui.item.id);
- self._trigger("selected", null, {
+ self._trigger("selected", event, {
item: select.find("[value='" + ui.item.id + "']")
});
@@ -56,6 +55,7 @@
})
.addClass("ui-widget ui-widget-content ui-corner-left");
$("<button>&nbsp;</button>")
+ .attr("tabIndex", -1)
.attr("title", "Show All Items")
.insertAfter(input)
.button({
@@ -81,7 +81,10 @@
})(jQuery);
$(function() {
- $("select").combobox();
+ $("#combobox").combobox();
+ $("#toggle").click(function() {
+ $("#combobox").toggle();
+ });
});
</script>
</head>
@@ -91,7 +94,8 @@
<div class="ui-widget">
<label>Your preferred programming language: </label>
- <select>
+ <select id="combobox">
+ <option value="">Select one...</option>
<option value="a">asp</option>
<option value="c">c</option>
<option value="cpp">c++</option>
@@ -107,6 +111,7 @@
<option value="s">scala</option>
</select>
</div>
+<button id="toggle">Show underlying select</button>
</div><!-- End demo -->
diff --git a/demos/autocomplete/index.html b/demos/autocomplete/index.html
index 9389b076d..42f13dc4b 100644
--- a/demos/autocomplete/index.html
+++ b/demos/autocomplete/index.html
@@ -16,6 +16,7 @@
<li><a href="combobox.html">Combobox</a></li>
<li><a href="custom-data.html">Custom data and display</a></li>
<li><a href="xml.html">XML data parsed once</a></li>
+ <li><a href="categories.html">Categories</a></li>
</ul>
</div>
</body>
diff --git a/demos/button/splitbutton.html b/demos/button/splitbutton.html
index b42fe520a..7e4d66038 100644
--- a/demos/button/splitbutton.html
+++ b/demos/button/splitbutton.html
@@ -11,21 +11,23 @@
<link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
- $("#rerun").button().click(function() {
- alert("Running the last action");
- })
+ $("#rerun")
+ .button()
+ .click( function() {
+ alert( "Running the last action" );
+ })
.next()
- .button({
- text: false,
- icons: {
- primary: "ui-icon-triangle-1-s"
- }
- })
- .click(function() {
- alert("Could display a menu to select an action");
- })
+ .button( {
+ text: false,
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ }
+ })
+ .click( function() {
+ alert( "Could display a menu to select an action" );
+ })
.parent()
- .buttonset();
+ .buttonset();
});
</script>
<style>
diff --git a/demos/droppable/index.html b/demos/droppable/index.html
index c2e08eef8..e0c4e6ae2 100644
--- a/demos/droppable/index.html
+++ b/demos/droppable/index.html
@@ -15,6 +15,7 @@
<li><a href="propagation.html">Prevent propagation</a></li>
<li><a href="visual-feedback.html">Visual feedback</a></li>
<li><a href="revert.html">Revert draggable position</a></li>
+ <li><a href="shopping-cart.html">Shopping Cart</a></li>
<li><a href="photo-manager.html">Simple photo manager</a></li>
</ul>
</div>
diff --git a/demos/droppable/shopping-cart.html b/demos/droppable/shopping-cart.html
new file mode 100644
index 000000000..de8ce4fe3
--- /dev/null
+++ b/demos/droppable/shopping-cart.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Droppable - Shopping Cart Demo</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.droppable.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.accordion.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <style type="text/css">
+ h1 { padding: .2em; margin: 0; }
+ #products { float:left; width: 500px; margin-right: 2em; }
+ #cart { width: 200px; float: left; }
+ /* style the list to maximize the droppable hitarea */
+ #cart ol { margin: 0; padding: 1em 0 1em 3em; }
+ </style>
+ <script type="text/javascript">
+ $(function() {
+ $("#catalog").accordion();
+ $("#catalog li").draggable({
+ appendTo: "body",
+ helper: "clone"
+ });
+ $("#cart ol").droppable({
+ activeClass: "ui-state-default",
+ hoverClass: "ui-state-hover",
+ accept: ":not(.ui-sortable-helper)",
+ drop: function(event, ui) {
+ $(this).find(".placeholder").remove();
+ $("<li></li>").text(ui.draggable.text()).appendTo(this);
+ }
+ }).sortable({
+ items: "li:not(.placeholder)",
+ sort: function() {
+ // gets added unintentionally by droppable interacting with sortable
+ // using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
+ $(this).removeClass("ui-state-default");
+ }
+ });
+
+ });
+ </script>
+</head>
+<body>
+<div class="demo">
+
+<div id="products">
+ <h1 class="ui-widget-header">Products</h1>
+ <div id="catalog">
+ <h3><a href="#">T-Shirts</a></h3>
+ <div>
+ <ul>
+ <li>Lolcat Shirt</li>
+ <li>Cheezeburger Shirt</li>
+ <li>Buckit Shirt</li>
+ </ul>
+ </div>
+ <h3><a href="#">Bags</a></h3>
+ <div>
+ <ul>
+ <li>Zebra Striped</li>
+ <li>Black Leather</li>
+ <li>Alligator Leather</li>
+ </ul>
+ </div>
+ <h3><a href="#">Gadgets</a></h3>
+ <div>
+ <ul>
+ <li>iPhone</li>
+ <li>iPod</li>
+ <li>iPad</li>
+ </ul>
+ </div>
+ </div>
+</div>
+
+<div id="cart">
+ <h1 class="ui-widget-header">Shopping Cart</h1>
+ <div class="ui-widget-content">
+ <ol>
+ <li class="placeholder">Add your items here</li>
+ </ol>
+ </div>
+</div>
+
+</div><!-- End demo -->
+
+<div class="demo-description">
+
+<p>Demonstrate how to use an accordion to structure products into a catalog and make use drag and drop for adding
+them to a shopping cart, where they are sortable.</p>
+
+</div><!-- End demo-description -->
+</body>
+</html>
diff --git a/demos/index.html b/demos/index.html
index c9f690921..db3e2bf83 100644
--- a/demos/index.html
+++ b/demos/index.html
@@ -25,7 +25,6 @@
<script type="text/javascript" src="../ui/jquery.ui.slider.js"></script>
<script type="text/javascript" src="../ui/jquery.ui.sortable.js"></script>
<script type="text/javascript" src="../ui/jquery.ui.tabs.js"></script>
- <script type="text/javascript" src="../ui/jquery.ui.tooltip.js"></script>
<script type="text/javascript" src="../ui/jquery.effects.core.js"></script>
<script type="text/javascript" src="../ui/jquery.effects.blind.js"></script>
<script type="text/javascript" src="../ui/jquery.effects.bounce.js"></script>
@@ -269,7 +268,6 @@
<dd><a href="progressbar/index.html">Progressbar</a></dd>
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="tabs/index.html">Tabs</a></dd>
- <dd><a href="tooltip/index.html">Tooltip</a></dd>
<dt>Effects</dt>
<dd><a href="animate/index.html">Color Animation</a></dd>
<dd><a href="toggleClass/index.html">Toggle Class</a></dd>
diff --git a/demos/tabs/cookie.html b/demos/tabs/cookie.html
new file mode 100644
index 000000000..638ee37f2
--- /dev/null
+++ b/demos/tabs/cookie.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Tabs - Default functionality</title>
+ <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
+ <script type="text/javascript" src="../../external/jquery.cookie.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.tabs.js"></script>
+ <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $(function() {
+ $("#tabs").tabs({
+ cookie: {
+ // store cookie for a day, without, it would be a session cookie
+ expires: 1
+ }
+ });
+ });
+ </script>
+</head>
+<body>
+
+<div class="demo">
+
+<div id="tabs">
+ <ul>
+ <li><a href="#tabs-1">Nunc tincidunt</a></li>
+ <li><a href="#tabs-2">Proin dolor</a></li>
+ <li><a href="#tabs-3">Aenean lacinia</a></li>
+ </ul>
+ <div id="tabs-1">
+ <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
+ </div>
+ <div id="tabs-2">
+ <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
+ </div>
+ <div id="tabs-3">
+ <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
+ <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
+ </div>
+</div>
+
+</div><!-- End demo -->
+
+<div class="demo-description">
+
+<p>Looks the same as the default demo, but uses cookie to store the selected tab, and restore it when the page (re)loads.
+
+The cookie is stored for a day, so tabs will be restored even after closing the browser. Use cookie: {} for using cookies with default options.</p>
+
+</div><!-- End demo-description -->
+
+</body>
+</html>
diff --git a/demos/tabs/index.html b/demos/tabs/index.html
index 48b3636c3..8fc417a4f 100644
--- a/demos/tabs/index.html
+++ b/demos/tabs/index.html
@@ -17,6 +17,7 @@
<li><a href="sortable.html">Sortable</a></li>
<li><a href="manipulation.html">Simple manipulation</a></li>
<li><a href="bottom.html">Tabs below content</a></li>
+ <li><a href="cookie.html">Cookie persistence</a></li>
</ul>
</div>
diff --git a/demos/tooltip/default.html b/demos/tooltip/default.html
deleted file mode 100644
index 22dac4f90..000000000
--- a/demos/tooltip/default.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Tooltip - Default demo</title>
- <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
- $(function() {
- $("a, input").tooltip();
- });
- </script>
- <style>
- label { display: inline-block; width: 5em; }
- </style>
-</head>
-<body>
-
-<div class="demo">
-
- <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
- the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
- </p>
- <p>But as it's not a native tooltip, it can be styled. Any themes built with
- <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
- will also style tooltip's accordingly.</p>
- <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
- <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
- <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
-
-</div><!-- End demo -->
-
-
-
-<div class="demo-description">
-
-<p>Hover the links above or use the tab key to cycle the focus on each element.</p>
-
-</div><!-- End demo-description -->
-
-
-
-</body>
-</html>
diff --git a/demos/tooltip/forms.html b/demos/tooltip/forms.html
deleted file mode 100644
index 626161d6e..000000000
--- a/demos/tooltip/forms.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Tooltip - Default demo</title>
- <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
- $(function() {
- $("[title]").tooltip();
- $("<button/>").text("Show help").button().toggle(function() {
- $(":ui-tooltip").tooltip("open");
- }, function() {
- $(":ui-tooltip").tooltip("close");
- }).appendTo("form");
- });
- </script>
- <style>
- label { display: inline-block; width: 5em; }
- .ui-icon { display: inline-block; }
- fieldset div {
- margin-bottom: 2em;
- }
- .ui-tooltip { width: 200px; }
- </style>
-</head>
-<body>
-
-<div class="demo">
-
- <form>
- <fieldset>
- <div>
- <label for="firstname">Firstname</label>
- <input id="firstname" name="firstname" />
- <span title="Please provide your firstname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
- </div>
- <div>
- <label for="lastname">Lastname</label>
- <input id="lastname" name="lastname" />
- <span title="Please provide also your lastname." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
- </div>
- <div>
- <label for="address">Address</label>
- <input id="address" name="address" />
- <span title="Your home or work address." class="ui-state-default ui-corner-all ui-icon ui-icon-help">?</span>
- </div>
- </fieldset>
- </form>
-
-</div><!-- End demo -->
-
-
-
-<div class="demo-description">
-
-<p>Hover the questionmark-buttons or use the button below to display the help texts all at once. Click again to hide them.</p>
-
-</div><!-- End demo-description -->
-
-
-
-</body>
-</html>
diff --git a/demos/tooltip/index.html b/demos/tooltip/index.html
deleted file mode 100644
index ed5cd10e5..000000000
--- a/demos/tooltip/index.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Tooltip Demos</title>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
-</head>
-<body>
-
-<div class="demos-nav">
- <h4>Examples</h4>
- <ul>
- <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
- <!--
- <li><a href="foo.html">Foo</a></li>
- <li><a href="bar.html">Bar</a></li>
- -->
- </ul>
-</div>
-
-</body>
-</html>
diff --git a/demos/tooltip/tracking.html b/demos/tooltip/tracking.html
deleted file mode 100644
index 9af4d0d09..000000000
--- a/demos/tooltip/tracking.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Tooltip - Default demo</title>
- <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
- $(function() {
- $("a, input").tooltip({
- open: function() {
- var tooltip = $(this).tooltip("widget");
- $(document).mousemove(function(event) {
- tooltip.position({
- my: "left center",
- at: "right center",
- offset: "25 25",
- of: event
- });
- })
- // trigger once to override element-relative positioning
- .mousemove();
- },
- close: function() {
- $(document).unbind("mousemove");
- }
- });
- });
- </script>
- <style>
- label { display: inline-block; width: 5em; }
- </style>
-</head>
-<body>
-
-<div class="demo">
-
- <p><a href="#" title="That's what this widget is">Tooltips</a> can be attached to any element. When you hover
- the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
- </p>
- <p>But as it's not a native tooltip, it can be styled. Any themes built with
- <a href="http://themeroller.com" title="ThemeRoller, jQuery UI's theme builder application">ThemeRoller</a>
- will also style tooltip's accordingly.</p>
- <p>Tooltip's are also useful for form elements, to show some additional information in the context of each field.</p>
- <p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes." /></p>
- <p>Click the field to see the tooltip; when you tab out of the field, it gets hidden.</p>
-
-</div><!-- End demo -->
-
-
-
-<div class="demo-description">
-
-<p>Here the tooltips are positioned relative to the mouse, and follow the mouse while it moves above the element.</p>
-
-</div><!-- End demo-description -->
-
-
-
-</body>
-</html>