$(document).ready(function() {
if ((screen.width==240) )
{
$('.verybig').hide();
}
else
{
$('.verybig').show();
}
}); 我想要240px屏幕的移动设备来隐藏类“非常大”的ui元素。上述情况看起来像是正确的情况吗?我找不到代码以完全不可预测的方式运行的任何模式。
发布于 2013-01-20 08:30:14
我认为您应该使用小于或等于。
$(document).ready(function() {
if (screen.width<=240) {
$('.verybig').hide();
} else {
$('.verybig').show();
}
}); 您可以将其重构为以下内容:
$(function() {
$('.verybig').toggle(screen.width > 240);
}); https://stackoverflow.com/questions/14420464
复制相似问题