jQuery UI Accordion - 如何完全删除样式?

标签 jquery jquery-ui accordion

我喜欢 jQuery Accordion (http://jqueryui.com/demos/accordion/) 的功能,但我不想要这种风格!!

我想删除所有样式、img、边框、颜色等...

我没有看到这个选项,这是他们应该添加的内容。还是我误会了?

最佳答案

你可以制作自己的 Accordion 。在没有 UI 的情况下使用 jQuery Accordion 是没有意义的。创建适合您网站的您自己的 Accordion 很容易。您只需要修复您想要的构建方式...比方说:

<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 实际上不需要它们。 请注意,类“content”中的 可以包含您想要的任何内容,包括 、other 或 因为 .siblings 和 .next 仅适用于同一层次结构。

关于jQuery UI Accordion - 如何完全删除样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4287225/

相关文章:

css - Accordion 不适用于 Chrome Mobile

javascript - jquery 中面板的 Accordion 调整高度

asp.net-mvc - jquery .ajax 请求被长时间运行的 .ajax 请求阻止

jquery - 使用 CSS 格式化响应式菜单 (jQuery)

android - 未知 Chrome 错误 : -6 (jquery mobile)

jquery - 用jquery选择显示文本框?

jquery - MVC3 - 如何维护回发时的选项卡索引

jquery - 具有动态 ajax 内容的 Bootstrap Accordion

javascript - 将拖放从 jquery-ui-sortable 列表更改为单击事件

javascript - Jquery UI "drop"效果 - 背景移动