github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 553
    • 89
  • Source
  • Commits
  • Network (89)
  • Graphs
  • Tree: c9a877e

click here to add a description

click here to add a homepage

  • Switch Branches (7)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
  • Switch Tags (18)
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Adding shopping cart demo for integration of accordion, draggable, droppable and 
sortable
jzaefferer (author)
Tue Mar 30 12:57:43 -0700 2010
commit  c9a877e81a0138c933c0
tree    9544de85707923e40c7a
parent  5baa18077698f16e2471
A demos/droppable/shopping-cart.html 96 •••••
Txt demos/droppable/shopping-cart.html
  • View file @ c9a877e
... ...
@@ -0,0 +1,96 @@
  1
+<!DOCTYPE html>
  2
+<html lang="en">
  3
+<head>
  4
+  <meta charset="UTF-8" />
  5
+  <title>jQuery UI Droppable - Default Demo</title>
  6
+  <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
  7
+  <script type="text/javascript" src="../../jquery-1.4.2.js"></script>
  8
+  <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
  9
+  <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
  10
+  <script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
  11
+  <script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
  12
+  <script type="text/javascript" src="../../ui/jquery.ui.droppable.js"></script>
  13
+  <script type="text/javascript" src="../../ui/jquery.ui.sortable.js"></script>
  14
+  <script type="text/javascript" src="../../ui/jquery.ui.accordion.js"></script>
  15
+  <link type="text/css" href="../demos.css" rel="stylesheet" />
  16
+  <style type="text/css">
  17
+  h1 { padding: .2em; margin: 0; }
  18
+  #products { float:left; width: 500px; margin-right: 2em; }
  19
+  #cart { width: 200px; float: left; }
  20
+  /* style the list to maximize the droppable hitarea */
  21
+  #cart ol { margin: 0; padding: 1em 0 1em 3em; }
  22
+  </style>
  23
+  <script type="text/javascript">
  24
+  $(function() {
  25
+    $("#catalog").accordion();
  26
+    $("#catalog li").draggable({
  27
+      appendTo: "body",
  28
+      helper: "clone"
  29
+    });
  30
+    $("#cart ol").droppable({
  31
+      activeClass: "ui-state-default",
  32
+      hoverClass: "ui-state-hover",
  33
+      accept: ":not(.ui-sortable-helper)",
  34
+      drop: function(event, ui) {
  35
+        $(this).find(".placeholder").remove();
  36
+        $("<li></li>").text(ui.draggable.text()).appendTo(this);
  37
+      }
  38
+    }).sortable({
  39
+      items: "li:not(.placeholder)"
  40
+    });
  41
+
  42
+  });
  43
+  </script>
  44
+</head>
  45
+<body>
  46
+<div class="demo">
  47
+  
  48
+<div id="products">
  49
+  <h1 class="ui-widget-header">Products</h1>  
  50
+  <div id="catalog">
  51
+    <h3><a href="#">T-Shirts</a></h3>
  52
+    <div>
  53
+      <ul>
  54
+        <li>Lolcat Shirt</li>
  55
+        <li>Cheezeburger Shirt</li>
  56
+        <li>Buckit Shirt</li>
  57
+      </ul>
  58
+    </div>
  59
+    <h3><a href="#">Bags</a></h3>
  60
+    <div>
  61
+      <ul>
  62
+        <li>Zebra Striped</li>
  63
+        <li>Black Lether</li>
  64
+        <li>Alligator Lether</li>
  65
+      </ul>
  66
+    </div>
  67
+    <h3><a href="#">Gadgets</a></h3>
  68
+    <div>
  69
+      <ul>
  70
+        <li>iPhone</li>
  71
+        <li>iPod</li>
  72
+        <li>iPad</li>
  73
+      </ul>
  74
+    </div>
  75
+  </div>
  76
+</div>
  77
+
  78
+<div id="cart">
  79
+  <h1 class="ui-widget-header">Shopping Cart</h1>
  80
+  <div class="ui-widget-content">
  81
+    <ol>
  82
+      <li class="placeholder">Add your items here</li>
  83
+    </ol>
  84
+  </div>
  85
+</div>
  86
+
  87
+</div><!-- End demo -->
  88
+
  89
+<div class="demo-description">
  90
+
  91
+<p>Demonstrate how to use an accordion to structure products into a catalog and make use drag and drop for adding
  92
+them to a shopping cart, where they are sortable.</p>
  93
+
  94
+</div><!-- End demo-description -->
  95
+</body>
  96
+</html>

0 notes on commit c9a877e

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server