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

javascript - Bootstrap collapse not firing on first click in IE - Stack Overflow

programmeradmin7浏览0评论

I'm using bootstrap collapse without the accordion markup.

This function is working fine in FF, Chrome etc. In ie7, 8 & 9 it works, but only the second time I click on 'trigger'.

$('.trigger').click(function(e){
    e.preventDefault();
    $(this).closest('.item').find('.item-dropdown').collapse('toggle');
});

Any ideas why?

I'm using bootstrap collapse without the accordion markup.

This function is working fine in FF, Chrome etc. In ie7, 8 & 9 it works, but only the second time I click on 'trigger'.

$('.trigger').click(function(e){
    e.preventDefault();
    $(this).closest('.item').find('.item-dropdown').collapse('toggle');
});

Any ideas why?

Share Improve this question asked Mar 21, 2013 at 3:15 Nicole HarrisNicole Harris 8601 gold badge13 silver badges27 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 7

Found this SO question:

Bootstrap 2.1.1 "Collapsible" not opening first time in IE

"This problem is not related to IE : this will happen on any browser that doesn't support transitions (or if it is deactivated).

That's because you need to initialize the plugin first. If you don't, it both initializes and toggles the collapse on the first click : the default initialization toggles the collapse (doc), and without the transitions, the collapse is toggled twice in a row without being seen."

发布评论

评论列表(0)

  1. 暂无评论