0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

横幅によってJavaScriptを一部無効化有効化にする方法

Posted at

やりたいこと
横幅481pxより大きい場合はjavascript(stickUp)を有効させる
横幅481pxより小さい場合はjavascript(stickUp)を無効にさせる

jQuery(function($){
  $(function() {
  var w = jQuery(window).width();
  var x = 481;
  if (w >= x) {
    $(".nav-wrapper").stickUp();
  }
  });
});

var w = jQuery(window).width();で横幅を取得する

jQuery(function($){
  $(function() {
  var w = jQuery(window).width();
  var x = 481;
  if (w >= x) {
    $(".クラス名").〇〇();
  }
  });
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?