LoginSignup
1
0

More than 3 years have passed since last update.

レスポンシブデザイン対応(addClass, removeClass)

Posted at
1 / 2
// リロード時
$(function() {
  // ウィンドウサイズ768px以下の場合、クラスを削除
  if (window.matchMedia( '(max-width: 768px)' ).matches) {
  $(function(){
    $('.tabs__content').removeClass('order-last');
  });
  //768px以上の場合なにもしない
    } else {
  };
});
// リサイズ時
$(window).resize(function(){
  let x = $(window).width();
  let y = 768;
  if (x <= y) {
    $('.tabs__content').removeClass('order-last');
  }
  else {
    $('.tabs').addClass('order-last');
  }
});
1
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
1
0