如何使用JavaScript檢查snapview是否正常工作。SnapView檢查javascript
var SNAPPED_VIEW = 320;
window.addEventListener("resize", onViewStateChanged);
function onViewStateChanged(eventArgs) {
var viewStates = Windows.UI.ViewManagement.ApplicationViewState, msg;
var newViewState = Windows.UI.ViewManagement.ApplicationView.value;
if (newViewState === viewStates.snapped) {
var msg = new Windows.UI.Popups.MessageDialog("snap view mode");
} else if (newViewState === viewStates.filled) {
showMenu('filled');
} else if (newViewState === viewStates.fullScreenLandscape) {
showMenu('landscape');
} else if (newViewState === viewStates.fullScreenPortrait) {
//Currently not supported
}
}
使用此代碼我試圖做的,但它是用破發點時,顯示不確定的。
具體什麼是不確定的?你的對話框不會真的做任何事情,因爲你沒有顯示它,但你的代碼似乎只是通過將它放到default.js中正確工作。 –