Created
July 9, 2010 09:47
-
-
Save Luke-23ae/469290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.observe("dom:loaded", function() { | |
var customsPage = Class.create({ | |
initialize: function(page, draggable_obj) { | |
if(draggable_obj) | |
this.draggableObject = new Draggable(draggable_obj); | |
Object.extend(page, this); | |
}, | |
deactivate_draggable: function() { | |
if(this.draggableObject) | |
Draggables.unregister(this.draggableObject); | |
} | |
}); | |
$$('.customizations_page').each(function(page) { | |
var object_to_drag = null; | |
switch(page.readAttribute("id")) { | |
case "pagetitle": | |
object_to_drag = $$("#header h1").first(); | |
break; | |
} | |
new customsPage(page, object_to_drag); | |
page.observe("layout:show", function(event) { | |
var last_active_page = $$('#customizations_menu li.active').first(); | |
this.deactivate_draggable(); // works like a charm | |
last_active_page.deactivate_draggable(); // fails. TypeError: Result of expression 'last_active_page.deactivate_draggable' [undefined] is not a function. | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment