Jump to content

SOLVED - jQuery: Question about classes set with expressions...


ahschmidt

Recommended Posts

What I am trying to do is to create an effect where a element (called 'box') is rolled over, and an image appears. When you roll over it a second time another image appears, and so forth.The image urls are pulled from an array which will loop once the end of the array is reached.What I would like to do, and am not sure is working is the the previous image should be deleted so I don't have a crazy stack of images. I think that I am running into problems by the way that I am adding classes to the images to choose the right one to be deleted.

$(document).ready(function(){		var i = 0;		$(".box").mouseover(		function(){						$(".imgHolder").append('<img class="thisImg '+('img'+i)+'" src="images/'+imgArray[i]+'" />');			$('img').remove('img'+(i-1));  //<-- This is the delete line that I don't think is working correctly.  			// - ignore this line for the time being... it is here to make the images stack in the Z axis.  $(".thisImg").css({position:"absolute",top:50,left:0});			if(i==(imgArray.length-1)){				i=0;			}else{				i++;				}						});});

Thanks for any help you can provide!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...