Tag: strange bugs

Fixing the ‘jQuery Lightboxes’ plugin for Magento

Last Friday, I was struggling with a strange issue on a Magento site I was working on. It worked fine in everything except IE – IE8 spat out lots of errors about certain lines in the Prototype and jQuery libraries, and refused to run any other code, which made the site unusable.

I soon decided it was worth updating jQuery top the latest version, as the one shipped with the jQuery Lightboxes plugin was several versions behind. (To upgrade, you’ll first need to disable the plugin’s version by going to the Magento dashboard, then System -> Configuration, select the ‘MAGEPSYCHO EXTENSIONS’ -> ‘jQuery LightBoxes’ option on the left, then set ‘Include jQuery file’ to ‘No’. To then include jQuery, add an ‘addCss’ action to your local.xml file – search online if you don’t know how to do this.)

I upgraded to the latest jQuery, and the Javascript problem was replaced by a different, more bizarre problem: every page would half-load, the IE would freeze for 5 to 10 minutes, and then everything would work perfectly. This stumped me for ages. Then finally this morning I came across mentions that AlphaImageLoader can really slow IE down. (AlphaImageLoader is used to add support for transparent PNG images in IE6.) Sure enough, the CSS file for jQuery Lightboxes had a lot of occurrences of AlphaImageLoader. I removed them, and the horrible freeze vanished, and IE6 is a low enough priority that this isn’t a problem.

Hopefully this will prove useful to someone!