Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Export "orientationchange" in $.fn

  • Loading branch information...
commit ad09822fbed643062810dfde114a60fb746b2113 1 parent 0a4a188
@gseguin authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 js/jquery.mobile.events.orientationchange.js
View
9 js/jquery.mobile.events.orientationchange.js
@@ -8,6 +8,7 @@ define( [ "jquery", "./jquery.mobile.support.orientation", "./jquery.mobile.even
(function( $, window ) {
var win = $( window ),
+ event_name = "orientationchange",
special_event,
get_orientation,
last_orientation,
@@ -112,7 +113,7 @@ define( [ "jquery", "./jquery.mobile.support.orientation", "./jquery.mobile.even
if ( orientation !== last_orientation ) {
// The orientation has changed, so trigger the orientationchange event.
last_orientation = orientation;
- win.trigger( "orientationchange" );
+ win.trigger( event_name );
}
}
@@ -137,6 +138,12 @@ define( [ "jquery", "./jquery.mobile.support.orientation", "./jquery.mobile.even
return isPortrait ? "portrait" : "landscape";
};
+ $.fn[ event_name ] = function( fn ) {
+ return fn ? this.bind( event_name, fn ) : this.trigger( event_name );
+ };
+
+ $.attrFn[ event_name ] = true;
+
}( jQuery, this ));
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
Please sign in to comment.
Something went wrong with that request. Please try again.