PDA

View Full Version : jQuery click function wont work after animation


Eyveneena
03-31-2009, 05:23 AM
Just hoping someone might guide me on this script..after they are resized, the click function on the images will not work so that the image can be prepended to another div. It doesnt work in IE.8 nor Firefox. Other than that...the images resize great and will accept animation:

[CODE]

$("#thumb> img").load(function(){

$("#thumb> img").each(function(i){

if($(this).width() > $(this).height())
{

$(this).animate({width:"100%",height:"auto"}).fadeIn("8000");
}else{

$("#thumb> img").animate({height:"100%",width:"auto"}).fadeIn("8000");}

});

});

$("#thumb>img").click(function(){

$(this).clone().prependTo("#left-container");



});

[CODE]

thank you :),

Eyveneena

Eldarrion
03-31-2009, 03:27 PM
Seems to work fine like this:


<script type="text/javascript">
$(document).ready(function() {
$("#thumb> img").load(function(){
$("#thumb> img").each(function(i){
if($(this).width() > $(this).height()) {
$(this).animate({width:"100%",height:"auto"}).fadeIn("8000");
} else {
$("#thumb> img").animate({height:"100%",width:"auto"}).fadeIn("8000");
}
});
});
$("#thumb > img").click(function(){
$(this).clone().prependTo("#left-container");
});
})
</script>


All in all, sounds like you're not executing the .click on $(document).ready

Eyveneena
04-15-2009, 07:34 PM
Sorry for taking so long to reply. This is exactly what I was trying to do....


Eyveneena