【发布时间】:2014-05-23 01:30:39
【问题描述】:
我不确定标题是否指向我的问题,但是: 我想用一个链接同时显示两个不同的元素(内容和图像)。它有点像内容和图像滑块,所以如果单击链接 1 attr content1 和 image1,如果单击链接 2 attr content2 和 image2 等等上..
这样我可以吸引盒子,但我怎么也叫图像呢?
$(".box").hide();
$(".box:first").show();
$("a").click(function() {
var activeLink = $(this).attr("href");
$("a").removeClass("active");
$(".box").hide();
$(activeLink).slideDown("normal");
return false;
});
我已经来了这么远.. http://jsfiddle.net/2GR3W/2/
提前谢谢!
【问题讨论】:
-
尝试为每个要隐藏/显示的元素分配唯一 ID。
标签: javascript jquery css