-1

I've got a Application wich offers possibilities to produce normal or responsive content.

Now I want to implement a preview Funktion so the user can test and switch automaticall between the views, like its implemented in chrome.

enter image description here

Just want three buttons, smartphone, tablet, desktop. Does someone have a great Idea how to do this nicely? It should work in all current browsers :)

Thanks

Lior Shitrit
  • 101
  • 7
Felix
  • 5,452
  • 12
  • 68
  • 163

1 Answers1

1

Solution 1: Resize Browser Window - this will give you a new viewport, which any relative width then adapts to. Use

window.resizeTo(width, height);

(source: this answer) no need for jquery.

Also take a look here: http://www.w3schools.com/jsref/met_win_resizeto.asp

Solution 2: Edit the viewport itself. As found in a 5 second search in this solution.

viewport = document.getElementById('viewport');
viewport.setAttribute('content', 'width=YOURWIDTH');
Community
  • 1
  • 1
dasjanik
  • 326
  • 3
  • 12