Skip to content

Instantly share code, notes, and snippets.

@cajones
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cajones/a7d09065796c491dcba6 to your computer and use it in GitHub Desktop.
Save cajones/a7d09065796c491dcba6 to your computer and use it in GitHub Desktop.
how to reference jquery mobile from an adapt plugin. This assumes that you have jquery.mobile-1.4.2min.js in the same directory. This can be used to detect orientation change events.
{
"name":"adapt-orientation-change",
"main":"main.js"
}
//download from http://jquerymobile.com/
define(['coreJS/adapt', './jquery.mobile-1.4.2.min', 'jquery'], function (Adapt, jqueryMobile, $) {
//subscribe jquery event
$( window ).on( "orientationchange", function( event ) {
//publish adapt event
Adapt.trigger('orientation:change', event.orientation);
});
Adapt.on('orientation:change', function (orientation) {
console.log("This device is in " + orientation + " mode!" );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment