Archive for August, 2008
YUI MenuCreator : generic show/hide code
Wednesday, August 27th, 2008At work I frequently encounter designs that utilize a mouseover show/mouseout hide menu that usually consists of a trigger (often an A tag, or LI element) and a menu (often a DIV, or a UL). Due to the browser inconsistencies between event handling and mouseout/mouseover DOM detection, it can be cumbersome to create a menu that is quick to implement (thus cost effective) and most importantly, stable. It also has support for a delay threshold, and the ability to animate show and hide events.
YUI CustomEvent subscriptions
Sunday, August 10th, 2008Recently at Ajaxian there was a post describing Custom Events and how they could be used to better structure an event-driven application by ’subscribing’ or ‘binding’ certain actions to an event. At Pint we use YUI as our main library, so I’ve ported the author’s example into a version that uses YUI.
Here is the code:
YAHOO.util.Event.onDOMReady(function() {
document.body.event1 = new YAHOO.util.CustomEvent();
YAHOO.util.Event.on('colorchange', 'change', function(e) {
if (this.checked) document.body.event1.subscribe(changeColor);
else document.body.event1.unsubscribe(changeColor);
});
YAHOO.util.Event.on('contentchange', 'change', function(e) {
if (this.checked) document.body.event1.subscribe(changeContent);
else document.body.event1.unsubscribe(changeContent);
}
});
YAHOO.util.Event.on(document.getElementById('leftchoices').childNodes, 'click', function(e) {
document.body.event1.fire(e);
});
});
Skatin it up
Saturday, August 2nd, 2008Posting from my iphone
Friday, August 1st, 2008Categories
-
Archives
-
You are currently browsing the Dylan Butler » Web Development and Consultation blog archives for August, 2008.
About This Site
DylanButler.com is the blog and portfolio of Dylan Butler, a San Diego web developer and consultant.









