js:
$(function () {
$("#menu ul li").each(function (i) {
//i(key)相当于for循环时的循环控制变量
alert(i + "内容:" + $(this.html));
$(this).click(function () {
var selector = "#divcount div:eq(" + i + ")"; //选中的
var notselector = "#divcount div:not(:eq(" + i + "))";
$(selector).show("fast"); //把选中菜单对应的div显示出来
$(notselector).hide("fast");
alert(selector + $(this.html));
alert(notselector + $(this.html));
});
});
});
div:
<div id="divcount" class="owl-carousel banner-carousel white-grapper" >
<div class="item" name="quwei" id="quwei">
<a href="360/裕州区位-jpg/quwei.html"> <img alt="区域沙盘" src="pic/quwei.jpg" ondblclick="go1()" border="0"/></a>
</div>
<div class="item" name="yuzhou" id="yuzhou">
<a href="360/裕州C41-jpg/yuzhouC41.html"> <img alt="裕州C41" src="pic/cccc.jpg" ondblclick="go2()"/>
</a>
</div>
<div>
div:
<div id="menu">
<ul>
<li><a href="PC-HTML-DW.html#yuzhou">裕州C41</li>
<li><a href="PC-HTML-DW.html#quwei" />区域沙盘</li>
</ul>
</div>
为什么不能正常显示,请教各位大神帮帮忙看看
可以使用jquery的trigger来绑定事件
求完整代码(复制可运行的),这看起来好乱