How to detect which Bootstrap version is used from JavaScript?

后端 未结 5 1992
清酒与你
清酒与你 2020-12-29 22:34

I\'ve been looking at the CSS & JavaScript from Bootstrap 3. Nothing is modularized under a common alias. For the JavaScript, it is injected into jQuery\'s prototype...<

5条回答
  •  臣服心动
    2020-12-29 22:34

    As suggested in comments, the only function that seems to be removed in Bootstrap 3 was typehead, even then - there doesn't seem to be a reliable way of detecting which Bootstrap version the site has loaded.

    var bsVersion = ( typeof $.fn.typeahead !== 'undefined' ? '2.3.2' : '3.0.0' );
    

提交回复
热议问题