页面大小改变了,我想失去div(Jquery)

时间:2015-05-01 08:32:13

标签: jquery

boolean bool = "rubber".equals(tool);
if (bool) {
    this.setLayerType(LAYER_TYPE_SOFTWARE, canvasPaint);    //or canvas.setLayer...
}
//drawing stuff
if (bool) {
    this.setLayerType(LAYER_TYPE_HARDWARE, canvasPaint);
}
 if ($(window).width() <= 480) {

            $(".content").hide();

        }

不行。请帮助。

3 个答案:

答案 0 :(得分:1)

您似乎希望在.resize()事件中看到此内容:

$(function(){ // <----doc ready.
    $(window).resize(function(){ //<----resize event bound on window.
      if ($(window).width() <= 480) {
          $(".content").hide(); 
      }
    }).resize(); // <----triggered the event on doc ready.
});

See this in action here.

答案 1 :(得分:0)

在$(window).resize()和$(document).ready()事件上显示和隐藏.content块。 $(window).resize()的示例:

$(window).resize(function() {
    $(".content").toggle($(window).width() >= 480);
});

答案 2 :(得分:-1)

if ($(window).width() <= 480) {
  $(".content").hide();
}
<div class="content">
  <div class="ui-menu-item"><span style="color:white" class="glyphicon glyphicon-phone" aria-hidden="true"> 0(333)3333333</span></div>
   <a href="mailto:info@bbbbbbbweb.com"><div class="ui-menu-item"><span style="color:white" class="glyphicon glyphicon-envelope" aria-hidden="true"> info@bldkcomweb.com</span></div></a>
</div>

你能帮忙吗?当屏幕尺寸缩小时,我想丢失上面的div