I have modified the gallery script from http://usejquery.com/blog/create-unique-gallery-using-z-index-and-jquery and it works fine in all browsers but IE10. See it here: http://174.122.126.251/~arblockt/index.html
. The photos are supposed to "shuffle" the top image to the bottom of the stack but in IE10 the top photo remains on top.
Here is the modified script:
$(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);
});
Can anyone see why this works in every browser (even old versions of IE) but not IE10?
Thanks in advance for your help.
UPDATE: It is still not working in IE10 but I did notice that if you let it continue to run for a while, the top picture will eventually move to the back, but the new top picture will do the same thing and stay on top. Very odd.
UPDATE #2: I just resized the IE10 window as it was running and it immediately started working properly. Any idea what could be causing this very strange behavior? Thanks!