Hi,
I am using sizzle to select various parts of the DOM.
My code is below. The problem is that the onmouseup event is being triggered when the page is loaded instead of when the user interacts with the page.
Can someone explain why this is please.
Thanks.
// Effects object
var effects = {
// Display an object
show : function(obj) {
obj.style.display = 'block';
},
// Hide an object
hide : function(obj) {
obj.style.display = 'hide';
},
// Toggle
toggle : function(obj) {
if (obj instanceof Array) {
alert('array');
} else {
alert('single');
}
}
}
// Selector Class
var s = Sizzle;
window.onload = function() {
s('#toggle-content').onmouseup = effects.toggle(s('.hidden-content'));
}
HTML as requested:
<div class="page-content box create-page">
<h1><span class="left">Create Page</span><a class="right" id="toggle-content" href="#">Expand</a></h1>
<div class="hidden-content">
...
</div>
</div>