博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Accordion插件如何实现图标效果啊?

Posted on 2011-11-16 17:25  止水  阅读(288)  评论(0)    收藏  举报

Q:

 

手风琴效果插件,默认的样式是QQ截图20111116120653.png,如何修改它的每行高度,还有把图标修改成QQ截图20111116120538.png

这个效果,大大的图标,我使用background属性去修改改来改去没有效果。论坛牛人多,稍微点拨一下就够我研究半天了,本人不是很懂,麻烦写出详细的语句。

  </style>
         
  <script type="text/javascript" src="https://www.cnblogs.com/../Inetpub/wwwroot/jquery-1.6.2.min.js"></script>
  <script type="text/javascript" src="http://www.cnblogs.com/../Inetpub/wwwroot/jquery-ui-1.8.16.custom.min.js"></script>
 
      <script type="text/javascript">
    
        $(function() {
               
                $( "#accordion" ).accordion({
                       
              collapsible: true
                });
        });
        </script>

 

 

A:

 

<h3><a href="#"><img src="images/1.png" />Section 1</a></h3>
只需要在<a></a>中添加图像的引用就可以了。<img src="images/1.png" />

 

 

NOTE: If you want multiple sections open at once, don't use an accordion

An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:

jQuery(document).ready(function(){
	$('.accordion .head').click(function() {
		$(this).next().toggle();
		return false;
	}).next().hide();
});

Or animated:

jQuery(document).ready(function(){
	$('.accordion .head').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
});