Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    click function wont work after animation

    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

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    Seems to work fine like this:

    Code:
    <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
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • Users who have thanked Eldarrion for this post:

    Eyveneena (04-01-2009)

  • #3
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile Thank You Sooo.. Much

    Sorry for taking so long to reply. This is exactly what I was trying to do....


    Eyveneena


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •