aboutsummaryrefslogtreecommitdiffstats
path: root/demos/real-world/layout/demo.js
diff options
context:
space:
mode:
Diffstat (limited to 'demos/real-world/layout/demo.js')
-rw-r--r--demos/real-world/layout/demo.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/demos/real-world/layout/demo.js b/demos/real-world/layout/demo.js
index 3696c58d1..ba854e850 100644
--- a/demos/real-world/layout/demo.js
+++ b/demos/real-world/layout/demo.js
@@ -6,28 +6,28 @@
.filter(':first').addClass('first').find('.up').addClass('disabled').end().end()
.filter(':last').addClass('last').find('.down').addClass('disabled').end().end();
};
-
+
function moveUpDown() {
var link = $(this),
dl = link.parents('dl'),
prev = dl.prev('dl'),
next = dl.next('dl');
-
+
if(link.is('.up') && prev.length > 0)
dl.insertBefore(prev);
-
+
if(link.is('.down') && next.length > 0)
dl.insertAfter(next);
-
+
updateUpDown(dl.parent());
};
-
+
function addControls() {
$(this).append('<span class="options"><a class="up">up</a><a class="down">down</a></span>')
.find('a.up, a.down').bind('click', moveUpDown);
updateUpDown($(this).parents(".ui-sortable:first"));
}
-
+
var counter = 1;
function addItem() {
var sortable = $(this).parents('.ui-sortable:first');
@@ -38,11 +38,11 @@
sortable.append(html).sortable('refresh').find('a.up, a.down').bind('click', moveUpDown);
updateUpDown(sortable);
};
-
+
function emptyTrashCan(item) {
item.remove();
};
-
+
function sortableChange(event, ui) {
if(ui.sender){
var w = ui.element.width();
@@ -50,7 +50,7 @@
ui.helper.css("width",ui.element.children().width());
}
};
-
+
function sortableUpdate(event, ui) {
if(ui.element[0].id == 'trashcan'){
emptyTrashCan(ui.item);
@@ -60,22 +60,22 @@
updateUpDown(ui.sender[0]);
}
};
-
+
$(document).ready(function(){
var els = ['#header', '#content', '#sidebar', '#footer', '#trashcan'];
var $els = $(els.toString());
-
+
$('h2', $els.slice(0,-1)).append('<span class="options"><a class="add">add</a></span>');
$('dt', $els).each(addControls);
//$('dt', $els).append('<span class="options"><a class="up">up</a><a class="down">down</a></span>');
-
+
$('a.add').bind('click', addItem);
//$('a.up, a.down').bind('click', moveUpDown);
-
+
$els.each(function(){
updateUpDown(this);
});
-
+
$els.sortable({
items: '> dl',
handle: 'dt',
@@ -101,7 +101,7 @@
handle: 'dt'
})
});
-
+
$(window).bind('load',function(){
setTimeout(function(){
// fixes the weird scrolling in IE while killing the fade