簡體   English   中英

如何在 jquery 中使用 css 媒體查詢?

[英]How can i use css media queries in jquery?

如何在下面的 jquery 中使用 css 媒體查詢?

$('document').ready(function() {
  $('.lws_woorewards_sponsorship_submit').click(function() {
    $('.lar-history-grid-title').css('margin-top','-20px');
  });
});

實際上,我想在單擊僅用於移動設備的按鈕時為 .lar-history-grid-title 留出余量。 最大寬度 768px;

檢查 screen.width 或使用 innerWidth。

  if(screen.width <= 768) {
     //Your code
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM