try this

have an html markup like this

<div class="wrap">
 <a href="#" class="mybutton">
 <div class="imgwrap">
  <img src="my/image/path.jpg" />
 </div>
</div>


here is the jQuery that i would use

$(function() {
 var obj = $(".wrap"); // we want the object to be our div wrapper
 var mybutton = $(".mybutton", obj); // we declare our button within the
object
 var myimg = $(".imgwrap", obj); // we declare our image within the object
 mybutton.click(function(e) { // button click event
  e.preventDefault(); // prevent default hyper link behavior
  myimg.animate({ marginLeft:300+'px'}, 1000); // andimate the image to move
300px to the left within 1 second ( 1000 = 1 second )
 });
});

your complete html file should look like this

<html>
 <head>
   <script type="text/javascript" src="jquery.js"></script>
   <script type="text/javascript">
$(function() {
 var obj = $(".wrap"); // we want the object to be our div wrapper
 var mybutton = $(".mybutton", obj); // we declare our button within the
object
 var myimg = $(".imgwrap", obj); // we declare our image within the object
 mybutton.click(function(e) { // button click event
  e.preventDefault(); // prevent default hyper link behavior
  myimg.animate({ marginLeft:300+'px'}, 1000); // andimate the image to move
300px to the left within 1 second ( 1000 = 1 second )
 });
});
   </script>
 </head>
 <body>
<div class="wrap">
 <a href="#" class="mybutton">
 <div class="imgwrap">
  <img src="my/image/path.jpg" />
 </div>
</div>
  </body>
</html>
On Fri, Oct 30, 2009 at 7:53 AM, hno <hno2...@gmail.com> wrote:

> HI
> i'm a new member of this group and I have two questions :
>
> i want a jquery code that when i click the button , it select the
> imgae obove the button and move it to another place and it show the
> image  when it moving .
>
> is there any book or web site that shows the jquery examples . i've
> searched alot but i havn't found thing .
>
> thanks
>
>

Reply via email to