【发布时间】:2012-02-18 21:39:29
【问题描述】:
我正在使用以下代码在单击链接时展开/折叠一些文本
当文本展开并具有不同的图像(即arrow_up.png)时,我需要将链接名称更改为“隐藏”。
我该怎么做?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var $divView = $('div.view');
var innerHeight = $divView.removeClass('view').height();
$divView.addClass('view');
$('div.slide').click(function() {
$('div.view').animate({
height: (($divView.height() == 90)? innerHeight : "90px")
}, 500);
return false;
});
});
</script>
<div class="view">
<ul class="moduleItemExtraFields">
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
<li>text here</li>
</ul>
</div>
<div class="slide">Show <img src="images/arrow_down.png" /></div>
【问题讨论】:
标签: php jquery toggle collapse