0

Demo-site: http://83.249.244.210:8080/img/

Try refreshing the site a few times in Firefox. When the images fade in, some of them flicker a bit. Can anyone please explain why?

This is how i load my images:

$(function(){

        $.post('service.php?getPhotos', function(data){

            var loadCount = 0;

            $.each(data, function(){

                $.post('service.php?getImage', { id: this.id }, function(data2){

                    loadCount++;

                    var $galleryItem = $('<div/>')
                        .hide()
                        .attr({ 'class': 'galleryItem' })
                        .html('<a href="'+ data2.photo.id +'"><img src="http://farm'+ data2.photo.farm +'.staticflickr.com/'+ data2.photo.server +'/'+ data2.photo.id +'_'+ data2.photo.secret + '_q.jpg"/></a><h3>'+ data2.photo.title._content +'</h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod ultrices ante, ac laoreet nulla vestibulum adipiscing.</p>');

                    $('#container').append($galleryItem); 

                    $galleryItem.find('img').load(function(){

                        $galleryItem.fadeIn(200);
                    });

                });

            });
        });

    });
4

1 回答 1

1

也许尝试在jQuery淡入之前用css隐藏图像?

#container > div {
    display: none;
}
于 2012-09-12T20:37:17.833 回答