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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Arizona
    Posts
    111
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Hello. Sliding in an image to a certain point.

    Hello,
    I was wondering if anybody could tell me or suggest to me a way to slide an image in to a certain. For example, 100px's down from top and 500px's from left. I figured out how to slide in but it only goes until the entire image is visible. I thought jquery could do it but can't figure out how. I was thinking JavaScript could do it to, but don't know how.

    Any info would be very appreciated. Thank you.

    Shane

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,445
    Thanks
    23
    Thanked 630 Times in 629 Posts
    jquery is javascript.
    Place image where you want it to end up and then use position:relative; on it. You have to use position:relative; or absolute. Use left: and/or top: to move it off screen. Then jquery to bring it back:
    Code:
    <script> 
    $(document).ready(function(){
      $("button").click(function(){
        $("div").animate({left:'100px'}); // OR WHERE YOU WANT IT.
      });
    });
    </script>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Tags for this Thread

    Posting Permissions

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