最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I change accordion header with plus and minus symbol? - Stack Overflow

programmeradmin1浏览0评论

I don't like the default Accordion icons and I want to change them. This link here:

shows the option to change the header but it requires to specify icons. I don't need icons. I just need a simple (+) and (-)

How can I do that with accordions?

I don't like the default Accordion icons and I want to change them. This link here:

http://jqueryui./demos/accordion/#option-header

shows the option to change the header but it requires to specify icons. I don't need icons. I just need a simple (+) and (-)

How can I do that with accordions?

Share Improve this question asked May 19, 2012 at 3:11 Tim TomTim Tom 2,1626 gold badges27 silver badges39 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Hiya working sample demo http://jsfiddle/zM5Vj/ or http://jsfiddle/zM5Vj/show/

Hope this helps, + will be shown when accordion is collapsed where as - in case of open accordion.

have a nice one!

Jquery code which adds + and - accordingly Rest full code is in fiddle, If you want I can copy paste the whole code. Please let me know how it goes!

$(function(){
 $('#accordion .fullChild>a.opener').text('+').addClass('box');

  $('#accordion .opener').click(function() {
  if($(this).text() == "-") {
  $(this).text("+");
  }
  else {
  $('#accordion .opener').text("+");
  $(this).text("-");
  }
});
});
发布评论

评论列表(0)

  1. 暂无评论