March 9th, 2009 |
Published in
Compatibility, Javascript, Mootools, multibox, phatfusion
I missed something when I modified Samuel Birch’s Multibox application to be compatible with Mootools 1.2. You see, when I did the rewrite I was using Mootools latest and greatest, version 1.2.1.
Imagine my chagrin (oh, the shame) when I discovered that it bombed against version 1.2! A little digging revealed that during the creation of 2 Fx.Morph objects, I had missed the old style of the transition: Fx.Transitions.sineInOut. Weirdly enough, 1.2.1 forgave my omission and ran without error. Version 1.2 wasn’t as nice about things. Anyway, long story short, I changed the transitions to Fx.Transitions.Sine.easeInOut and all seems right with the world now. Sorry. The download has been updated.
March 7th, 2009 |
Published in
Compatibility, Javascript, Mootools, multibox, phatfusion
For a recent project I needed a lightbox-style application that could handle multiple content types. You know, something flexible enough to show images, html, video, etc.
Multibox, a well-known JavaScript program by Samuel Birch, seemed a likely candidate. The problem: Multibox was written for Mootools version 1.1 and I needed to use version 1.2. So I rewrote multibox.js and overlay.js to make them compatible with the latest version of Mootools.
It’s a pretty straightforward rewrite; any code that’s been commented out is left over from the original and wasn’t done by me. I did, however, fix one bug while I was at it:
if(this.elementContent.getStyle('width') != 'auto'){
// Bug fix: this.elementContent.getStyle('width')
// returns 480px. This causes NaN (and IE error)
// in subsequent calculations. Fixed by invoking toInt().
this.contentObj.width = this.elementContent.getStyle('width').toInt();
}
The bug only affects situations where you want to take an inline html element (i.e., it’s already embedded on the page) and display it in the multibox. this.elementContent.getStyle(’width’) returns a string. In the demo it was returning 480px and this caused errors later on in the code. Adding toInt() to the end seems to have fixed it.
I would have posted this on phatfusion’s user forum but it has evidently been taken down for a spell.
Multibox is very handy for displaying all sorts of different content…and now it’s updated. I’ve gotten a lot of use out of it; I hope you do as well. Rather than distribute the updated js files separately, I simply bundled it back into Birch’s original download package. The script tags in the demo page have been updated to call for the rewritten files so it should (fingers crossed) run okay right out of the box.
Download it here.
It occurred to me after the fact that since Birch’s original download is kind of large, I ought to provide just the 2 rewritten files (multibox and overlay).