Jquery 在空载时评估方向事件?
我正在开发一个web应用程序,它要求我根据OrientionEvent更改内容。到目前为止,它工作得很好,在我改变方向的同时改变和设置内容。然而,我需要的方向也在onLoad火灾。这可能吗Jquery 在空载时评估方向事件?,jquery,orientation,screen-orientation,device-orientation,Jquery,Orientation,Screen Orientation,Device Orientation,我正在开发一个web应用程序,它要求我根据OrientionEvent更改内容。到目前为止,它工作得很好,在我改变方向的同时改变和设置内容。然而,我需要的方向也在onLoad火灾。这可能吗 $(document).ready(function(){ var onChanged = function() { //TODO: Need to learn a way to fire it at load time if(window.orientation == 90 || windo
$(document).ready(function(){
var onChanged = function() { //TODO: Need to learn a way to fire it at load time
if(window.orientation == 90 || window.orientation == -90){
$('#nav').html('<b> : LANDSCAPE : </b>');
}else{
$('#nav').html('<b> : PORTRAIT : </b>');
}
event.stopPropagation();
}
$(window).bind(orientationEvent, onChanged);
});
$(文档).ready(函数(){
var onChanged=function(){//TODO:需要学习在加载时启动它的方法
如果(window.orientation==90 | | window.orientation==-90){
$('#nav').html(':scape:');
}否则{
$('#nav').html(':crative:');
}
event.stopPropagation();
}
$(窗口).bind(定向事件,一旦更改);
});
var onChanged=function(){//TODO:需要学习在加载时启动它的方法
如果(window.orientation==90 | | window.orientation==-90){
$('#nav').html(':scape:');
}否则{
$('#nav').html(':crative:');
}
event.stopPropagation();
}
$(文档).ready(函数(){
$(窗口).bind(定向事件,一旦更改);
}).bind(“加载”,一旦更改);
var onChanged=function(){//TODO:需要学习在加载时启动它的方法
如果(window.orientation==90 | | window.orientation==-90){
$('#nav').html(':scape:');
}否则{
$('#nav').html(':crative:');
}
event.stopPropagation();
}
$(文档).ready(函数(){
$(窗口).bind(定向事件,一旦更改);
}).bind(“加载”,一旦更改);
var onChanged = function() { //TODO: Need to learn a way to fire it at load time
if(window.orientation == 90 || window.orientation == -90){
$('#nav').html('<b> : LANDSCAPE : </b>');
}else{
$('#nav').html('<b> : PORTRAIT : </b>');
}
event.stopPropagation();
}
$(document).ready(function(){
$(window).bind(orientationEvent, onChanged);
}).bind('load', onChanged);