image z-index at hover on a link
Hi, I have the below code, I want to have some images that each image is on the other image whan hover on a link it's specific image zoom in and it's z-index becom the higher one. and the opacity of other images becom lower. I don't know how should i set z-index at js. my code is below:
- <script type="text/javascript">
- $(function () {
- $('#left a').hover(function () {
- var indeX = $('#left a').index(this);
- $('#right img').eq(indeX).stop(true, false)
- .animate({ width: '100px', height: '100px', opacity: 1 }, 500);
- }, function () {
- $('#right img').stop(true, false)
- .animate({ width: '50px', height: '50px', opacity: 0.5 }, 500);
- });
- })
- </script>
the css
- <style type="text/css">
- #left {
- width:38%;
- height:500px;
- float:left;
- border:1px solid blue;
- }
- #right {
- width:60%;
- height:500px;
- float:right;
- border:1px solid red;
- }
- #right img {
- width:50px;
- height:50px;
- opacity: 0.5;
- }
- </style>
the html:
- <div id="left">
- <a href="#">imge1</a>
- <a href="#">imge2</a>
- <a href="#">imge3</a>
- <a href="#">imge4</a>
- </div>
- <div id="right">
- <img src="1.jpg"style="z-index:200;"/>
- <img src="2.jpg" style="z-index:190; position:relative; left:-40px;" />
- <img src="3.jpg"style="z-index:180; position:relative; left:-80px;" />
- <img src="4.jpg"style="z-index:170;position:relative; left:-100px;" />
- </div>