Last active
August 29, 2015 14:00
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"adapt-orientation-change", | |
"main":"main.js" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//download from http://jquerymobile.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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