sequential JQUERY smooth transition for IPAD
im creating this frame by frame fadein fadeout image but the problem is the ipad is rendering it very slow.is there a better way to do this here is my code:
var counter = 1,
srcStr1 = "../img/landscape/p25/",
srcStr2 = ".jpg",
frames = $("<div id=\"frames\"></div>"),
removeFrame = function() {
if (frames.children().len开发者_运维技巧gth > 1) {
frames.children(":first").fadeOut({},40).queue(function(nxt) {
$(this).remove();
nxt();
});
} else {
clearInterval(timer);
}
},
timer = setInterval(function() { removeFrame() },40);
////////create frames
for(var x = 3; x--;) {
$("<img />", {
src: srcStr1 + counter + srcStr2
}).css("zIndex", x).appendTo(frames);
counter++;}
frames.appendTo("#belo").fadeIn("slow");
If you encounter rendering artifacts on iOS due to the tiled rendering engine of the GPU not vsync-ing after the transition, the following may help:
<style type="text/css">
html, body { -webkit-transform: translateZ(0); }
</style>
精彩评论