Please help...

I am a bit concerned here as things are not behaving quite as i expect
them to...

FF3 / 1.2 final 

Basically, a simple idea - intercept links to full view of images and
code something like slimbox - in pseudo code, it goes like:

<a href="/blah.jpg" class="full"><img src="/blah_thumb.jpg" /></a>
...
$$(".full").addEvents({
        "click": function(e) {
                var e = new Event(e).stop();
                new Asset.image(el.get("href"), {
                        onload: function() {
                                // do stuff... like modal view, center
                                // big mamaries....
                                this.inject(somewhere);
                        },
                        onerror: function() {
                                // i assume, failing to get image should
                                // alert here
                                alert("image not found?");
                        },
                        onabort: function() {
                                // same as above.
                                alert("image not found");
                        }
                }
        }
});

when it works, it works fine - the problem is, sometimes the a href points
to a missing image (404). i don't want to be building a modal view,
setting events and so forth if that's the case, i need to trap and
discard the click silently instead, removing the click event  and so
forth. but "onfail" never fires, neither does onabort...

To quote the manual page:
http://docs.mootools.net/Plugins/Assets#Assets:image

WARNING: DO NOT use addEvent for load/error/abort on the returned element, 
give them as onload/onerror/onabort in the properties argument.

now what? :(


-- 
http://fragged.org/

Reply via email to