This project is archived and is in readonly mode.

#126 ✓duplicate
Brian

Opera, Asset.images, and onComplete

Reported by Brian | June 13th, 2008 @ 10:15 PM

Opera 9.27 and Opera 9.5 seem to have an issue with Mootools v1.2 Asset.images ... when first loading the page with an empty cache ... onComplete would never fire, or I would get random results. Below is my workaround. (.each did not seem to work, either)

    var backgrounds = [
        'image1.jpg',
        'image2.jpg'
    ];

    if(window.opera) {

        var counter = 0;
        for(src=0;src<backgrounds.length;src++) {
            var image = new Image();
            image.src = backgrounds[src];
            image.onload = counter++;
            if (counter == backgrounds.length) {
                myFunction();
            }
        }

    } else {

        new Asset.images(backgrounds, {
            onComplete: function() {
                myFunction();
            }
        });
    }

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Tags

Referenced by

Pages