Lately, I've been experimenting with creating a responsive button for our new website. The goal is to adjust the body width to 460px, simulating how our site would appear on mobile devices. While researching, I came across a technique that utilizes iframes – by adjusting the iframe width, the viewport width changes accordingly, thus achieving the desired responsiveness effect.
My challenge lies in implementing this using vanilla JavaScript. Although setting the body width is straightforward, Bootstrap and CSS media queries seem to ignore this custom width as they are based on viewport/screen width, which remains constant.
So, the question is: How can I get this to work? I have buttons representing mobile and desktop views, and they should be able to adjust the screen's width dynamically while ensuring that the media queries respond appropriately.
Is there a way to accomplish this? For context, my viewport is defined as:
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
and the media queries are structured like this:
@media screen and (min-width: 992px) {}