Respond.js-----20150415,respond.js

來源:互聯網
上載者:User

Respond.js-----20150415,respond.js

Respond.js讓IE6-8支援CSS3 Media Query。

Bootstrap裡面就引入了這個js檔案,從名字看出來是自適應的相容。開啟IE看了一下,效果挺好的,自適應的效果挺好的。Respond.js讓不支援CSS3 Media Query的瀏覽器包括IE6-IE8等其他瀏覽器支援查詢。的css路徑取出來放入數組2.然後遍曆數組一個個發ajax請求3.ajax回調後僅分析response中的media query的min-width和max-width文法,分析出viewport變化區間對應相應的css塊4.頁面初始化時和window.resize時,根據當前viewport使用相應的css塊。使用:考慮到IE9是支援CSS3的,所以直接在HTML頁面的head標籤中添加指令碼引用即可:<!--[if lt IE 9]>      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script><![endif]—> 官方demo地址:http://scottjehl.github.com/Respond/test/test.html 1.在css中正常用 min/max-width media queries @media screen and (min-width: 480px){        ...styles for 480px and up go here    } @media screen and (min-width: 480px){...styles for 480px and up go here}    2.引入respond.min.js,但要在css的後面(越早引入越好,在ie下面看到頁面閃屏的機率就越低,因為最初css會先渲染出來,如果respond.js載入得很後面,這時重新根據media query解析出來的css會再改變一次頁面的布局等,所以看起來有閃屏的現象)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.