http://usejquery.com/blog/create-unique-gallery-using-z-index-and-jqueryからギャラリー スクリプトを変更しましたが、IE10 以外のすべてのブラウザーで正常に動作します。こちらをご覧ください: http://174.122.126.251/~arblockt/index.html
. 写真は一番上の画像をスタックの一番下に「シャッフル」することになっていますが、IE10 では一番上の写真が一番上に残ります。
変更されたスクリプトは次のとおりです。
$(document).ready(function() {
var z = 0;
var inAnimation = false;
$('#pictures img').each(function() {
z++;
$(this).css('z-index', z);
});
function swapFirstLast() {
if(inAnimation) return false; //if already swapping pictures just return
else inAnimation = true; //set the flag that we process a image
$('#pictures img').each(function() { //process each image
if($(this).css('z-index') == z) { //if its the image we need to process
$(this).animate({ 'left' : '-' + $(this).width() + 'px' }, 'slow', function() { //animate the img above/under the gallery (assuming all pictures are equal height)
$(this).css('z-index', 1) //set new z-index
.animate({ 'left' : '0' }, 'slow', function() { //animate the image back to its original position
inAnimation = false; //reset the flag
});
});
} else { //not the image we need to process, only in/de-crease z-index
$(this).animate({ 'left' : '0' }, 'slow', function() { //make sure to wait swapping the z-index when image is above/under the gallery
$(this).css('z-index', parseInt($(this).css('z-index')) + 1); //in/de-crease the z-index by one
});
}
});
return false; //don't follow the clicked link
}
window.setInterval(swapFirstLast, 3000);
});
これがすべてのブラウザー (古いバージョンの IE を含む) で機能するのに、IE10 では機能しない理由を誰でも理解できますか?
よろしくお願いします。
更新: IE10 ではまだ動作していませんが、しばらく実行し続けると、トップの画像が最終的には背面に移動することに気付きましたが、新しいトップの画像は同じことを行い、上部にとどまります。非常に奇妙な。
更新 #2: 実行中の IE10 ウィンドウのサイズを変更したところ、すぐに適切に動作し始めました。この非常に奇妙な動作の原因は何ですか? ありがとう!