jquery - How do I slide between two images on mouse over? -


how can create section contaiinng 2 images side side expand 1 of images full width when hovering on it. i.e when hover on left hand side image image expand right display full image , cover image on right hand side. when hover on right hand side image expand left , cover left side image.

examples:

http://www.adhamdannaway.com/

http://www.car-vanstore.cz/

any appreciated, have been scouring net suitable jquery plugins , css tuts have far been unsuccessful.

thanks in advance!

the trick understand how 2 images overlap. have working copy of solution attached.

the method use relies on absolute positioning. allows elements go on each other. once done re size containers , set overflow hidden.

var mousex;    $("#live-zone").mousemove( function(e) {     mousex = e.pagex;      mousex = mousex+"px";     $("#x-pos").html("").append(mousex);     $("#div-one").css("width",mousex);   });  
img{      height:525px;/*only here ensure images same height*/  }  #img-one{      z-index:9999;  }  #div-one{      width:200px;      height: 525px;      overflow:hidden;      position:absolute;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>  <body>      <div id="live-zone">          <div id="div-one">              <img id="img-one" src="http://www.asia.ru/images/img/205795/ym-009.jpg">          </div>          <div id="div-two">              <img id="img-two" src="http://www.canadabillard.com/images/thumbs/0000781_600.jpg">          </div>      </div>      <div id="x-pos">          200px      </div>                </body>


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -