我喜欢jQuery手风琴(http://jqueryui.com/demos/accordion/)的功能,但我不想要样式!!
我想摆脱所有的样式、图片、边框、颜色等...
我没有看到这个选项,他们应该添加这个选项。或者我错了吗?
你可以制作自己的手风琴。使用jQuery手风琴而不使用UI是没有意义的。创建适合您网站的手风琴相当容易。您只需要解决想要构建它的方式即可,比如说:
<div id='container'>
<a href='javascript:;'>First link</a>
<div class='content'> SOME CONTENT HERE </div>
<a href='javascript:;'>Second link</a>
<div class='content'> SOME CONTENT HERE </div>
...
</div>
然后,你只需要做出这样的事情
//On click any <a> within the container
$('#container a').click(function(e) {
//Close all <div> but the <div> right after the clicked <a>
$(e.target).next('div').siblings('div').slideUp();
//Toggle open/close on the <div> after the <a>, opening it if not open.
$(e.target).next('div').slideToggle();
});
你现在可以随意编辑你的类,因为实际上你不需要它们来进行JavaScript操作。
请注意,带有'class'属性的 'content' 元素可以包含任何你想要的内容,包括 <div>
,<p>
或者其他元素,因为 .siblings 和 .next 只适用于同一层级。
collapsible: true
选项。 - AYK.ui-helper-*
类) - prodigitalson我需要(想要)做同样的事情。在我的情况下,我想去掉手风琴内容所提供的额外填充,它看起来像这样:
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content {padding: 0;}
这成功地设置(覆盖)了填充。
罗布
http://jqueryui.com/themeroller/
如果需要取消手风琴效果,只需取消复选框按钮“手风琴”并下载生成的文件即可。.ui-accordian
,还会有一些通用的.ui-widget
类需要重写。我通常在Firebug中加载它并查看被应用的样式,这样我就知道所有需要重写的内容,以实现我想要的外观和感觉。使用clearStyle选项来删除默认样式:
$( ".selector" ).accordion({ clearStyle: true });