0

I am using Jon Designs SmoothGallery on a website for one of my clients. The only problem is that I get a script error in IE8 when trying to go to the next image. I have checked this gallery in all major browser, and yet again, IE is the one where it doesn't work.

What a surprise.

I have been trying to find out what the problem was, but I only get an error in the eval-function of the mootools library which the gallery is based on, so no luck there.

Is there any way to set a "All-Exceptions Breakpoint", simular to setting one in Xcode, so that I could find the code that it actually hangs up on? Or does anyone know what is actually going on here?

The site is http://internetvolk.de/tische and the JS file responsible for the gallery is http://internetvolk.de/typo3conf/ext/rgsmoothgallery/res/scripts/jd.gallery1010.js

Thank you in advance,

Tobias Timpe

1 Answer 1

1

you are using a really old version of mootools - 0.89 or 1.0, if I am not mistaken. it's eval packed via dean edwards' PACKER, which makes it particularly hard to debug.

the instantiation code itself is somewhat awful and monkey patched:

function startGallery17() {
    if (window.gallery17) {
        try {
            var myGallery17 = new gallery($('myGallery17'), {
                timed: false,
                showArrows: true,
                showCarousel: false,
                textShowCarousel: 'Thumbnails',
                embedLinks: false,

                lightbox: true
            });
            var mylightbox = new LightboxSmoothgallery();
        } catch (error) {
            window.setTimeout("startGallery17();", 2500);
        }
    } else {
        window.gallery17 = true;
        if (this.ie) {
            window.setTimeout("startGallery17();", 3000);
        } else {
            window.setTimeout("startGallery17();", 100);
        }
    }
}
window.onDomReady(startGallery17);

the use of strings in setTimeouts causes evals here also, the try blocks will prevent you from getting any useful error feedback either.

if you want to get to the bottom of this, get rid of these hacks, load up say, this version of mootools - https://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools.js - still very old but newer than yours, or if possible, try 1.12 and see if debugging becomes easier.

then get rid of the try/catch blocks, use window.addEvent('domready', fn) to start your code - or if reliant on images being loaded, consider window.addEvent('load', fn) instead.

if all you do on the page is stack up some images with a next/previous, why not use latest mootools with a new plugin - there is NOTHING good about what you have picked.

eg, read this tutorial I wrote on how to do it: http://fragged.org/tutorial-write-a-small-content-slider-class-in-mootools-and-extend-it_1321.html or look on the forge: http://mootools.net/forge/ for something packaged

should be fine with 1.4.5 (latest).

keep in mind the version you are currently using will likely break ie9 and latest gecko

1
  • After actually looking at the version of mootools this plugin was using I just threw away all the JS and wrote my own gallery based on swipejs. Thanks for opening my eyes! May 19, 2012 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.