Twitter Bootstrap - 如何检测媒体查询何时开始 [英] Twitter Bootstrap - how to detect when media queries starts

查看:121
本文介绍了Twitter Bootstrap - 如何检测媒体查询何时开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在bootstrap-responsive.css媒体查询动作时最快,最简单的方法。

which is the fastest and easy way to fire when bootstrap-responsive.css media queries go in action?

进入动作=和网站已更改为响应移动

go in action = when you resize window to mobile width and site is changed to responsive mobile

希望问题清楚

推荐答案

使用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) { ... }

这篇关于Twitter Bootstrap - 如何检测媒体查询何时开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆