|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <!--[if lt IE 9]> |
| 5 | + <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
| 6 | + <![endif]--> |
| 7 | + |
| 8 | + <meta charset="utf-8"> |
| 9 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 10 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 11 | + <title>gridstack.js tests</title> |
| 12 | + |
| 13 | + <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> |
| 14 | + <link rel="stylesheet" href="../../../dist/gridstack.css"/> |
| 15 | + |
| 16 | + <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> |
| 17 | + <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script> |
| 18 | + <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> |
| 19 | + <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script> |
| 20 | + <script src="../../../dist/gridstack.js"></script> |
| 21 | + |
| 22 | + <style type="text/css"> |
| 23 | + .grid-stack { |
| 24 | + background: lightgoldenrodyellow; |
| 25 | + } |
| 26 | + |
| 27 | + .grid-stack-item-content { |
| 28 | + color: #2c3e50; |
| 29 | + text-align: center; |
| 30 | + background-color: #18bc9c; |
| 31 | + } |
| 32 | + </style> |
| 33 | +</head> |
| 34 | +<body> |
| 35 | + <div class="container-fluid"> |
| 36 | + <h1>gridstack.js tests</h1> |
| 37 | + |
| 38 | + <br/> |
| 39 | + |
| 40 | + <div class="grid-stack" id="grid"> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + |
| 44 | + |
| 45 | + <script type="text/javascript"> |
| 46 | + $(function() { |
| 47 | + var options = { |
| 48 | + height: 5 |
| 49 | + }; |
| 50 | + $('.grid-stack').gridstack(options); |
| 51 | + |
| 52 | + new function() { |
| 53 | + var items = [ |
| 54 | + {x: 0, y: 0, width: 2, height: 2}, |
| 55 | + {x: 2, y: 5, width: 1, height: 1} |
| 56 | + ]; |
| 57 | + |
| 58 | + this.grid = $('.grid-stack').data('gridstack'); |
| 59 | + this.grid.removeAll(); |
| 60 | + items = GridStackUI.Utils.sort(items); |
| 61 | + var id = 0; |
| 62 | + _.each(items, function(node) { |
| 63 | + var w = $('<div><div class="grid-stack-item-content" /><div/>'); |
| 64 | + w.attr('id', 'item-' + (++id)); |
| 65 | + this.grid.addWidget(w, |
| 66 | + node.x, node.y, node.width, node.height); |
| 67 | + }, this); |
| 68 | + }; |
| 69 | + }); |
| 70 | + </script> |
| 71 | +</body> |
| 72 | +</html> |
0 commit comments