mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02:00
Add 'lib/gridster/' from commit 'a7ed9a4adec9f7c8361ad6f392993a1f0b9c1601'
git-subtree-dir: lib/gridster git-subtree-mainline:80f8419dacgit-subtree-split:a7ed9a4ade
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Demo » Add widgets dynamically » gridster.js</title>
|
||||
<link rel="stylesheet" type="text/css" href="assets/css/demo.css">
|
||||
<link rel="stylesheet" type="text/css" href="../dist/jquery.gridster.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
||||
<script src="../dist/jquery.gridster.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Add widgets dynamically</h1>
|
||||
|
||||
<p>Create a grid adding widgets from an Array (not from HTML) using <code>add_widget</code> method. Widget position (col, row) not specified.</p>
|
||||
|
||||
<div class="gridster">
|
||||
<ul></ul>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" id="code">
|
||||
var gridster;
|
||||
|
||||
$(function () {
|
||||
|
||||
gridster = $(".gridster > ul").gridster({
|
||||
widget_margins: [5, 5],
|
||||
widget_base_dimensions: [100, 55]
|
||||
}).data('gridster');
|
||||
|
||||
var widgets = [
|
||||
['<li>0</li>', 1, 2],
|
||||
['<li>1</li>', 3, 2],
|
||||
['<li>2</li>', 3, 2],
|
||||
['<li>3</li>', 2, 1],
|
||||
['<li>4</li>', 4, 1],
|
||||
['<li>5</li>', 1, 2],
|
||||
['<li>6</li>', 2, 1],
|
||||
['<li>7</li>', 3, 2],
|
||||
['<li>8</li>', 1, 1],
|
||||
['<li>9</li>', 2, 2],
|
||||
['<li>10</li>', 1, 3]
|
||||
];
|
||||
|
||||
$.each(widgets, function (i, widget) {
|
||||
gridster.add_widget.apply(gridster, widget)
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user