0
就像默認使用的HTML標籤提供的肘細節和摘要(fiddle example),我試圖讓一個小撥動出現了這條左側基本jQuery的手風琴效果,像這樣(PNG):添加切換到基本的jQuery手風琴影響
到目前爲止,我有這樣的代碼:
HTML:
<div id="accordion">
<h4 class="accordion-toggle">TOGGLE ONE</h4>
<div class="accordion-content">
<p>Cras malesuada ultrices augue molestie risus.</p>
</div>
<h4 class="accordion-toggle">TOGGLE TWO</h4>
<div class="accordion-content">
<p>Lorem ipsum dolor sit amet mauris eu turpis.</p>
</div>
</div>
CSS:
.accordion-toggle {cursor: pointer; margin: 0;}
.accordion-content {display: none;}
.accordion-content.default {display: block;}
JQUERY:
$(document).ready(function($) {
$('#accordion').find('.accordion-toggle').click(function(){
//Expand or collapse this panel
$(this).next().slideToggle('fast');
//Hide the other panels
$(".accordion-content").not($(this).next()).slideUp('fast');
});
});
哇,感謝你的努力。我確實發現了類似的東西,但我正在仔細檢查你做了什麼。我有的主要問題是我試圖用實際站點中的圖像來完成這樣的事情:http://snag.gy/PVrAe.jpg由於箭頭現在使用bg圖像,我不知道如何實現它。我嘗試並實施它的每一種方式,最終都會裁剪出圖像。 – fakeguybrushthreepwood
@fakeguybrushthreepwood - 如果你有一個你找到的「類似的東西」的鏈接,請分享它。我基本上看過箭頭如何工作[JQuery UI Accordion](http://jqueryui.com/accordion/)。 –
@JohnS你可以使用unicode作爲箭頭;看到這個答案,我剛剛寫了幾個小時前.. http://stackoverflow.com/questions/21343744/make-the-contents-of-a-details-tag-animate-when-open-with-jquery-js/ 21345510#21345510它比密切相關。 1+ –