Calendar
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| << < | > >> | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | ||||
Archives
- October 2006 (3)
- September 2006 (10)
- August 2006 (10)
- July 2006 (53)
- June 2006 (1)
- November 2005 (2)
- More...
Monthly Statistics
Search
Syndicate this blog
Sliding Panels For moo.fx Part 2 meta info IntroductionSo the first post about moo.fx introduced a simpler way of hooking up sliding panels to moo.fx and while it worked well in Firefox it had issues with Internet Explorer. The second version addresses some shortcomings of IE and also describes a workaround for other issues. The last bit of news is that this article also includes a ZIP that you can download that has a complete and functioning demonstration of the library and will run as is in Firefox and Internet Explorer. Why this library?So you ask yourself, why is this implementation important and what does it do to help me? Here are a number of reasons why this library can make life easier and hopefully will give you a reason to use it.
How it worksBesides moo.fx, the rest of the magic is in the TSlidePanels Init method. The Init method uses getElementsByClassName from the moo.fx dom class to locate all of the slide panels. We then walk each of those elements to locate the toggle and content classes - this is done with getDescendantNode. We then connect the onclick event to each toggle and the hard work is done.So far we have found the slide panels but haven't made them do anything at all. When the user clicks on a toggle, we create an effect object and start it up. What we have done is postpone the initialization in the hope that we can speed up page loads and reduce memory usage. The usual problems1. The method that is called doesn't have access to the this operator but instead gets an event object which contains different information if you use Internet Explorer or Firefox. The workaround is that we try to sense the browser and access the data that we want. This is the code in a nutshell.var self = (e.target) ? e.target : e.srcElement; 2. We now have the HTML element that was clicked (see graphical problem below) but not the TSlidePanel object itself which contains much of what we need. Luckily the Init method stored a pointer to the TSlidePanel object in the toggle HTML element so we can reference it when we need to. Now we have a valid object that tells us what HTML element holds the content, which one is the toggle and which element may have a glyph. 3. The graphical problem is part of Internet Explorer. Firefox correctly identifies the toggle HTML element that was clicked even if that element was holding an IMG tag that was actually clicked. Internet Explorer on the hand identified the toggle element but incorrectly passes back the IMG element as its source so we lose access to our TSlidePanel object. To get around this we use CSS to display the image inside the toggle and avoid embedding an IMG. The demo has an example of this. The other magic is in the CSS, so refer back to the demo if you have any questions. Sliding Panels Demo Zip Sliding Panels Demo Link |
