【发布时间】:2012-12-16 04:04:26
【问题描述】:
<!DOCTYPE html>
<html>
<head>
<style>
p { margin:-3px 0px 0px 3px;
background:#212121;
width:175px;
padding:10px;
color:#fff;
font-weight:500;
font-size:14px; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button>Toggle 'em</button>
<p>I figured out how to get the toggle to look and work up to this point, but I can't seem to get this content box to appear ONLY AFTER the button is clicked upon NOT before. And, when the visitor doesn't want to see the content anymore, s/he would have to click on the button (toggling). If you happen to know how to incorporate a delayed auto close on this toggle, please do tell (if not, no biggie--not my main focus). Thanks! </p>
<script>
$("button").click(function () {
$("p").toggle("fast");
});
</script>
</body>
</html>
我对 JQuery 了解不多,但我使用了这个网站 http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_toggle 并想出了如何让切换器看起来和工作到这一点,但我似乎无法让这个内容框出现仅在单击按钮之后,而不是之前。而且,当访问者不想再看到内容时,他/她必须单击按钮(切换)。如果您碰巧知道如何在此切换中加入延迟自动关闭,请务必告诉(如果没有,没什么大不了的——不是我的主要关注点)。谢谢!
【问题讨论】:
-
嘿伙计,看看我的回答,有解决办法!
标签: jquery