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
Post a Comment