Can I change the media query using javascript / jQuery?

前端 未结 7 975
逝去的感伤
逝去的感伤 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:23

    Okay, I think I have a solution that fits me. I outsource the media query into an additional style.css (style-mobile.css for example). This file is only loaded if the window-width is the variable value.

    This solution fits me, but other may not find the answer for that problem here. Should I mark this answer as a solution anyway?

提交回复
热议问题