show(index) not working with IE8
Hey, I have been able to figure out what IE8 hates (show(index)), but not how to fix it. I know that what I need to do is having something.show(index), but I'm not sure what. Any tips would be awesome.
var index = 0;
var images = $("#gallery img");
var thumbs = $("#thumbs img");
var imgHeight = $(thumbs).attr("开发者_Python百科height");
$(thumbs).slice(0,3).clone().appendTo("#thumbs");
for (i=0; i<thumbs.length; i++)
{
$(thumbs[i]).addClass("thumb-"+i);
$(images[i]).addClass("image-"+i);
}
$("#next").click(sift);
show(index);
setInterval(sift, 8000);
function sift()
{
if (index<(thumbs.length-1)){index+=1 ; }
else {index=0}
show (index);
}
I think you just need:
$(thumbs[index]).show();
but I'm not 100% sure because I don't know exactly what your code wants to do.
The opposite of ".show()" is ".hide()". You can pass both of those methods arguments to tell them how long to take when showing the element.
精彩评论