jQuery UI手风琴-如何完全删除样式? [英] jQuery UI Accordion - How to remove style completly?

查看:81
本文介绍了jQuery UI手风琴-如何完全删除样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢jQuery手风琴(http://jqueryui.com/demos/accordion/)的功能,但是我不想要这种样式!!

I love the functionality of the jQuery accordion (http://jqueryui.com/demos/accordion/) however I do not want the style !!

我想摆脱所有样式,img,边框,颜色等...

I'd like to get rid of all the styles, the img, the border, the color, etc...

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

I don't see an option for this, this is something they should add. Or I am mistaking?

推荐答案

您可以制作自己的手风琴.在没有UI的情况下使用jQuery手风琴是没有意义的.创建适合您的站点的自己的手风琴有点容易.您只需要修复要构建的方式...可以这样说:

You can make your own accordion. Using the jQuery accordion without the UI is pointless. Creating your own accordion adapted to your site is kind of easy. You just need to fix the way you want to build it...let's say:

<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>

然后,您只需要做类似的事情

Then, you just need to make something like

//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. 请注意,带有内容"类的可以包含任何您想要的内容,包括,其他或其他内容,因为.siblings和.next仅适用于相同的层次结构.

You can now edit your class as you want since you actually don't need them for the JavaScript. Note that the with the class 'content' can contain whatever you want, including , other or since the .siblings and .next only apply to the same hierarchy.

这篇关于jQuery UI手风琴-如何完全删除样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆