2015-07-12 64 views
0

我试图移除桌面的滚动,但保持滚动手机和平板电脑。谁能告诉我为什么下面的代码不起作用?溢出-y不适用于媒体查询

/* Small devices (tablets, 768px and up) */ 
@media (min-width: @screen-sm-min) { 
    body { 
    overflow-y:visible; 
    } 
} 

/* Medium devices (desktops, 992px and up) */ 
@media (min-width: @screen-md-min) { 
    body { 
    overflow-y:visible; 
    } 
} 

/* Large devices (large desktops, 1200px and up) */ 
@media (min-width: @screen-lg-min) { 
    body { 
    overflow-y:hidden; 
    } 
} 
+0

是否也能提供HTML或为它创建一个小提琴? –

回答

0

既然你已经知道你的媒体查询断点,为什么不直接做PX的媒体查询,而不是像这样http://jsfiddle.net/96q3u6ne/

/* Small devices (tablets, 768px and up) */ 
@media (min-width: 768px){ 
    body { 
    overflow-y:visible; 
    } 
} 

/* Medium devices (desktops, 992px and up) */ 
@media (min-width: 992px) { 
    body { 
    overflow-y:visible; 
    } 
} 

/* Large devices (large desktops, 1200px and up) */ 
@media (min-width: 1200px) { 
    body { 
    overflow-y:hidden; 
    } 
}