且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Twitter Bootstrap - 如何检测媒体查询何时开始

更新时间:2023-02-06 15:34:15

使用jquery你可以找到当前窗口的大小,然后相应地做你的东西。

Using jquery you can find the size of current window and then accordingly do your stuff.

$(window).resize(function() {
  if ($(this).width() >= 1280) {
    //do something
  }
  else if ($(this).width() < 1280 && $(this).width()>= 980) {
    //do something
  }
  ...
});

CSS Twitter-Bootsrap-layouts

CSS:: Twitter-Bootsrap-layouts

/* Large desktop */
@media (min-width: 1200px) { ... }

/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }

/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }

/* Landscape phones and down */
@media (max-width: 480px) { ... }