mirror of
https://github.com/apache/cordova-plugin-screen-orientation.git
synced 2026-05-12 00:01:32 +08:00
working version of screen orientation plugin adhering to w3c specs
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@
|
||||
<button id="btnPortPrimary">Portrait - Primary</button>
|
||||
<button id="btnLandPrimary">Landscape - Primary</button>
|
||||
</div>
|
||||
<button id="btnAny">Any</button>
|
||||
<button id="btnAny">Unlock</button>
|
||||
</div>
|
||||
<script type="text/javascript" src="cordova.js"></script>
|
||||
<script type="text/javascript" src="js/index.js"></script>
|
||||
|
||||
+9
-18
@@ -36,44 +36,35 @@ var app = {
|
||||
onDeviceReady: function() {
|
||||
app.receivedEvent('deviceready');
|
||||
btnPortrait.addEventListener("click", function() {
|
||||
// alert('Orientation is ' + screen.orientation);
|
||||
screen.lockOrientation('portrait').then(function(obj) {
|
||||
screen.orientation.lock('portrait').then(function(obj) {
|
||||
console.log(obj);
|
||||
}).catch(function(obj) {
|
||||
}, function(obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
});
|
||||
btnLandscape.addEventListener("click", function() {
|
||||
// alert('Orientation is ' + screen.orientation);
|
||||
screen.lockOrientation('landscape').then(function(obj) {
|
||||
screen.orientation.lock('landscape').then(function(obj) {
|
||||
console.log(obj);
|
||||
}).catch(function(obj) {
|
||||
}, function(obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
});
|
||||
btnPortPrimary.addEventListener("click", function() {
|
||||
// alert('Orientation is ' + screen.orientation);
|
||||
screen.lockOrientation('portrait-primary').then(function(obj) {
|
||||
screen.orientation.lock('portrait-primary').then(function(obj) {
|
||||
console.log(obj);
|
||||
}).catch(function(obj) {
|
||||
}, function(obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
});
|
||||
btnLandPrimary.addEventListener("click", function() {
|
||||
// alert('Orientation is ' + screen.orientation);
|
||||
screen.lockOrientation('landscape-primary').then(function(obj) {
|
||||
screen.orientation.lock('landscape-primary').then(function(obj) {
|
||||
console.log(obj);
|
||||
}).catch(function(obj) {
|
||||
}, function(obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
});
|
||||
btnAny.addEventListener("click", function() {
|
||||
// alert('Orientation is ' + screen.orientation);
|
||||
screen.lockOrientation('any').then(function(obj) {
|
||||
console.log(obj);
|
||||
}).catch(function(obj) {
|
||||
console.log(obj);
|
||||
});
|
||||
screen.orientation.unlock();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user