B4J Question ABMaterial - locking orientation

JackKirk

Well-Known Member
Licensed User
Longtime User
In my continued exploration of ABMaterial I would like to work out how to lock browser orientation.

Only clue I have found so far is:

https://www.b4x.com/android/forum/threads/abmaterial-changing-the-page-orientation.91676/post-579044

by alwaysbusy/Alain which I reproduce below:

B4X:
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation:portrait) {

  body {

-webkit-transform: rotate(90deg);

width: 100%;

height: 100%;

   overflow: hidden;

   position: absolute;

top: 0;

left: 0;

  }

}

B4X:
$(document).ready(function () {

  function reorient(e) {

var portrait = (window.orientation % 180 == 0);

$("body").css("-webkit-transform", !portrait ? "rotate(-90deg)" : "");

  }

  window.onorientationchange = reorient;

window.setTimeout(reorient, 0);

});

Trouble is after a couple of hours messing around I can't for the life of me work out how I could insert this in the ABMMini project.

Any pointers would be greatly appreciated.
 
Top