单击选项卡式菜单中的链接时,我需要的图像应该出现在我想要所有链接数量的位置...这是我用于示例的代码...它对我不起作用...我需要知道正确答案...帮帮我...
<html>
<head>
<title>image event</title>
<script type="text/javascript" ></script>
<style type="text/css">
#detail {
width:320px;
height:180px;
margin-bottom:12px;
border: 1px solid #000000;
}
#detail div {
position:relative;
width:100%;
height:100%;
}
#detail div img {
position: absolute;
top: 0;
left:0;
width:100%;
height:100%;
z-index:1;
}
#detail div span {
color:#ffffff;
position:absolute;
bottom:0;
text-align:center;
width:100%;
background: #000000;
opacity: .8;
z-index:2;
}
#links img {
width:30px;
height:30px;
margin-left:16px;
}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-1.7.1.js">
var container = $('#detail');
container.find('div:first-child').fadeIn("slow");
$('a').click(function () {
var active = $(container.find('div')[$(this).prevAll('a').length]);
active.siblings().hide();
active.fadeIn("slow");
});
</script>
</head>
<body>
<div id="detail">
<div id="div1" style="display:none">
<span>CONTENT 1</span>
<img src="images/1.jpg"/>
</div>
<div id="div2" style="display:none;">
<span>CONTENT 2</span>
<img src="images/2.jpg" />
</div>
<div id="div3" style="display:none">
<span>CONTENT 3</span>
<img src="images/3.jpg" />
</div>
<div id="div4" style="display:none">
<span>CONTENT 4</span>
<img src="images/4.jpg" />
</div>
</div>
<div id="links">
<a href="#" name="div1" ><img src="images/1.jpg" /></a>
<a href="#" name="div2" ><img src="images/2.jpg" /></a>
<a href="#" name="div3" ><img src="images/3.jpg" /></a>
<a href="#" name="div4" ><img src="images/4.jpg" /></a>
</div>
</body>
</html>