Can I change the media query using javascript / jQuery?

前端 未结 7 977
逝去的感伤
逝去的感伤 2020-12-10 15:50

I have a style.css with a media query. In my javascript-file, I have a value for the desired mobile-width stored in a variable.

By changing the variable, I want to c

7条回答
  •  余生分开走
    2020-12-10 16:20

    You can write by using $(window).width()

    value=959;
    
    if($(window).width() < value)
    {
        $(".classname").css("color","white");
    }
    

提交回复
热议问题