orientationchange

このエントリーをはてなブックマークに追加

orientationchangeイベントはデバイスが縦から横もしくは横から縦の傾けられた際に発火するイベントです。

orientationchangeイベントではイベントオブジェクトにorientationというプロパティが追加されており、portrait(縦向き)もしくはlandscape(横向き)の情報が格納されています。

$(window).on('orientationchange',function(e){
	alert(e.orientation);
});

sample

orientationchangeイベントでは$.mobile.orientationChangeEnabledにfalseが指定されている場合、もしくは端末がJavaScriptのorientationchangeイベントをサポートしていない場合はjQueryのresizeイベントを利用して判定を行います。

登録日 : 2012年12月26日 最終更新日 : 2016年12月19日

同じカテゴリー(イベント)のエントリー

検索

スポンサードリンク

バージョン

リファレンス