Permalink
Browse files

Export "orientationchange" in $.fn

  • Loading branch information...
gseguin committed Jun 1, 2012
1 parent 0a4a188 commit ad09822fbed643062810dfde114a60fb746b2113
Showing with 8 additions and 1 deletion.
  1. +8 −1 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);

0 comments on commit ad09822

Please sign in to comment.