Jquery问题不是刷新浏览器

时间:2018-04-14 17:54:09

标签: javascript jquery

我编写以下代码,以便在浏览器宽度增加或减少时,jquery应该添加或删除容器类,但是需要刷新我不想要的浏览器,还有其他选择吗?

<script>
$(document).ready(function(){
if($(window).width() > 1183)
{
$('.intro > ul').removeClass('container');
}
else if ($(window).width() <= 1183)
{
$('.intro > ul').addClass('container');
}
});
</script>

1 个答案:

答案 0 :(得分:1)

您可以在不刷新的情况下收听窗口的resize事件

# Create a new instance
resource "google_compute_instance" "default" {
   name = "test"
   machine_type = "n1-standard-1"
   zone = "us-central1-a"
   boot_disk {
      initialize_params {
      image = "debian-cloud/debian-8"
   }
}
network_interface {
   network = "default"
   access_config {}
}

service_account {
   scopes = ["userinfo-email", "compute-ro", "storage-ro"]
   }
}

I am getting below error:

Error: Error applying plan:

1 error(s) occurred:

* google_compute_instance.default: 1 error(s) occurred:

* google_compute_instance.default: Error loading zone 'us-central1-a': googleapi: Error 403: Required 'compute.zones.get' permission for 'projects/project-1-200623/zones/us-central1-a', forbidden.

In

Listen to browser width / height changes with jQuery