javascript - Website reload after page orientation -


i have 1 page responsive website , don't want reload/refresh after page orientation. how can prevent this?

add piece of javascript page:

$(window).on('load', function() {     switch(window.orientation){       case -90:         contenttype = "rotated-right";       break;        case 90:         contenttype = "rotated-left";       break;     }     $('html').removeclass('rotated-left').removeclass('rotated-right').addclass('rotated-' + orientation) }); 

and css:

html.rotated-right {   transform: rotate(90deg);   -webkit-transform: rotate(90deg); }  html.rotated-left {   transform: rotate(-90deg);   -webkit-transform: rotate(-90deg); } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -