Search code examples
javascripthtmlcssmedia-queries

Change CSS' media queries through javascript


Is there a way to change a website's actual media queries through javascript ?

I'm developping an app contained in an iframe on my client's websites who recalculate body's width to place a panel in the right side. When the browser is resized, the client's media queries are called and act without taking my iframe into consideration resulting in a messed up layout.

Do you see a way for me to change the clients media queries with javascript so that I can keep the layout clean ?

Thanks for your help !


Solution

  • I found the answer here : https://stackoverflow.com/a/19593526/1324357 We can go to css with document.styleSheets.