感谢您的帮助..这是我的问题:下面的代码,当单击阅读更多...链接时应该显示链接下的 div,但只有在所有其他可能的 div 被隐藏之后...我需要按原样在回调中使用它,但是当这样使用时,第一个链接正确显示,最后三个显示,然后隐藏,然后显示......帮助!
Javascript:
var more_text="Read More...";
var less_text="Read Less...";
jQuery(document).ready(function() {
$j(".dropdown").click( function () {
if ($j(this).html() == more_text){
var that = $j(this);
$j(".extra").slideUp( function () {
$j(".dropdown").html(more_text);
that.html(less_text);
that.next(".extra").slideDown();
});
}
});
});
HTML:
<div class="dropdown">Read More...</div>
<div class="extra" style="display: none;">Here is more text!!</div>
<div class="dropdown">Read More...</div>
<div class="extra" style="display: none;">Here is more text!!</div>
<div class="dropdown">Read More...</div>
<div class="extra" style="display: none;">Here is more text!!</div>
<div class="dropdown">Read More...</div>
<div class="extra" style="display: none;">Here is more text!!</div>