gpt4 book ai didi

javascript - 如何完成剧透

转载 作者:行者123 更新时间:2023-11-28 15:56:57 25 4
gpt4 key购买 nike

有一个代码http://jsfiddle.net/VWCnd/5/ 。如何添加指标↓ ↑。示例图像 /image/OxpaP.png

Js:

$(document).ready(function(){
$('.spoiler_title').click(function(){
$(this).parent().children('div.spoiler_toggle').toggle();
return false;
});
});

html:

<div>
<a href="" class="spoiler_title">Title</a>
<div class="spoiler_toggle">
<div class="spoiler_bg">Body</div>
</div>
</div>

CSS:

.spoiler_title {
display:block;
background-color: #551A8B;
color: #fff;
padding: 10px 10px;
}
.spoiler_toggle {
display:none;
}
.spoiler_bg {
background: #9C6AC9;
padding: 5px 5px;
}

谢谢。

最佳答案

你总是可以做这样的事情:

http://jsfiddle.net/VWCnd/7/

 $('.spoiler_title').click(function(){
var $this = $(this),
visible = $this.parent().children('div.spoiler_toggle').toggle().is(':visible');
$this.find('.spoiler_indicator').html(visible? '&uarr;' : '&darr;');
return false;
});

关于javascript - 如何完成剧透,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18378598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com