css3 - Can we make our webpage open defaultly in landscape mode for mobile/tablets using media query/js/jquery? -


is possible make web page open default in landscape mode in mobile or tablet if orientation of screen off using css3 media query or jquery ??

you this. wether idea or not i'll let decide (hint: isn't).

check portrait orientation css , rotate body if necessary:

@media screen , (orientation:portrait) {     body {         transform: rotate(-90deg);         transform-origin: 50% 50%; } 

rotating body in way not cause it's width , height update suit it's new orientation have correct jquery:

function checkorientation() {     var winwidth = $(window).width();     var winheight = $(window).height();      if (winheight > winwidth) {         $('body').width(winheight).height(winwidth); // swap width , height of body if necessary     } }  checkorientation(); // check orientation on page load  // check orientation on page resize (mainly demo it's unlikely tablet's window size change) var resizeend; $(window).resize(function(){     cleartimeout(resizeend);    resizeend = settimeout(checkorientation, 100); }); 

demo (resize preview panel)


disclaimer: not tested in chrome.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -