Evaluate orientationEvent at onload?

I'm working on a web app and it requires me to alter content based on the orientationEvent. It's working well so far, changing and setting content as I change orientation. However, I need the orientationEvent to also fire at onLoad. Is this possible?

$(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); });

-------------Problems Reply------------

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);

Category:jquery Views:0 Time:2011-03-04

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.181 (s). 11 q(s)