Anna A. Anna A. - 2 years ago 216
Javascript Question

How can i simulate a responsive website like desktop in mobile?

I have a responsive website, in which i need to add a button "view classic version (Desktop)". The problem is that the site was made in responsive format and i can not redo it in the mobile version (both, mobile version and desktop version separated). Is there any way I could simulate a size of 1200px inside my mobile device (JS or JQuery)?

e.g. The website is using Bootstrap 3

Thanks!

Answer Source

Is necessary change the metatag viewport to desktop.

$(window).resize(function() {
  var mobileWidth =  (window.innerWidth > 0) ? window.innerWidth : screen.width;
  var viewport = (mobileWidth > 360) ? 'width=device-width, initial-scale=1.0' : 'width=1200';
  $("meta[name=viewport]").attr('content', viewport);
}).resize();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download