Respond.js简介
程序员文章站
2022-06-02 08:05:06
...
Respond.js
- 处理响应式设计中,浏览器不支持media query相关
- 官网:http://drupal.org/project/respondjs
- github:https://github.com/scottjehl/Respond
- test page : http://scottjehl.github.com/Respond/test/test.html
源码小谈:
- src版本的代码341行,算是比较简单
- 会生成一个全局的respond的对象:
- 写法采用use strict
- 核心事件resize:
if(win.addEventListener){ //非IE win.addEventListener("resize",callMedia,false); }else if(win.attachEvent){ //IE win.attachEvent("onresize",callMedia); }