Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
219 views
in Technique[技术] by (71.8m points)

Updating Bootstrap to version 3 - what do I have to do?

I'm new to Bootstrap and have the older version 2.3.2.

Version 3 has been released. Do I just simply replace the CSS and Javascript files if I want to use the latest version?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Download the latest version from http://getbootstrap.com/ OR Replace the css and js files with the newest versions or use CDN (http://www.bootstrapcdn.com/)

  2. Migrate your html, yes indeed read http://bootply.com/bootstrap-3-migration-guide. You could try http://twitterbootstrapmigrator.w3masters.nl/ or http://code.divshot.com/bootstrap3_upgrader/ (provide checklist too)

  3. remove html5shiv cause TB drops support for IE7 and Firefox 3.x add html5shiv.js to add support of HTML5 elements to IE8

  4. add respond.js (https://github.com/scottjehl/Respond) for media query support in IE. NOTE this won't work with CDN, see: IE8 issue with Twitter Bootstrap 3

  5. If you use Glyphicons, you will have to add them from http://glyphicons.getbootstrap.com/ ( icons have been moved to a separate repository.) Glyphicons are back since RC2 (180 glyphs in font format from the Glyphicon Halflings set)

  6. If you use the Javascript Typeahead component, you will have to integrate https://github.com/twitter/typeahead.js/ (cause typeahead javascript is dropped) See also: Typeahead problems with Bootstrap 3.0 RC1 Or use the "old" plugin: https://github.com/bassjobsen/Bootstrap-3-Typeahead, see also: https://stackoverflow.com/questions/18615964/ajax-call-in-bootstrap-3-0-typeahead/18620473

  7. Switch to the latest version of jQuery 1.x (don't use the 2.x version cause jQuery 2.x don't support IE8)

  8. If you use third party widgets which adds or insert html to your code (like addthis.com, sharethis.com and Google maps), create a wrapper for the box-sizing, see: Right border of the AddThis counter missing with Twitter's Bootstrap 3

Other:

Bootstrap 3 switch to box-sizing: border-box why?: https://stackoverflow.com/a/18858771/1596547

Note support for IE7 has been dropped. https://github.com/coliff/bootstrap-ie7 try to add the css part back with use of some conditional CSS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...