귀하의 HTML
<div class="articles">
<h3>Article Title 1</h3>
<div class="summary">
This is the summary for Article 1.
</div>
<span class="static" style="display:none;">Show Summary</span>
<span class="toggler">Show Summary</span>
</div>
<div class="articles">
<h3>Article Title 2</h3>
<div class="summary">
This is the summary for Article 2.
</div>
<span class="static" style="display:none;">Show Summary</span>
<span class="toggler">Show Summary</span>
</div>
<div class="articles">
<h3>Article Title 3</h3>
<div class="summary">
This is the summary for Article 3.
</div>
<span class="static" style="display:none;">Show Summary</span>
<span class="toggler">Show Summary</span>
</div>
<div class="articles">
<h3>Article Title 4</h3>
<div class="summary">
This is the summary for Article a.
</div>
<span class="static" style="display:none;">Show Summary</span>
<span class="toggler">Show Summary</span>
</div>
<div class="articles">
<h3>Article Title 5</h3>
<div class="summary">
This is the summary for Article 5.
</div>
<span class="static" style="display:none;">Show Summary</span>
<span class="toggler">Show Summary</span>
</div>
귀하의 jQuery를 ..
jQuery(document).ready(function($) {
$('.toggler').click(function() {
var _currentext = $('.toggler').html();
if(_currentext == "Show Summary") {
$('.toggler').html("Hide Summary");
$('.static').hide();
} else {
$('.toggler').html("Show Summary");
$('.static').html("Hide Summary");
$('.static').show();
}
$('.summary').not($(this).prev()).slideUp();
$(this).prev('.summary').slideToggle('slow');
});
});
"Articile Title"아래에 텍스트가 나타납니다. 이제 CSS로 배치하십시오.
"표시 ..."에서 "숨기기 ..."로 변경되지만 마우스를 각 기사 컨테이너에 놓으면 "요약 숨기기"텍스트가 사라집니다. 나는 그것을 숨길 때까지 "숨기기 요약"이 거기에 남아 있기를 원합니다. – bloggerious