Permalink
Browse files

binding these at mobileinit didn't help anything, and only hurt the a…

…bility to use them when jQM is dynamically appended. Idea credit to @martynsmith
  • Loading branch information...
1 parent 5fe78d5 commit 38d7ad8848f00b0921bf4ae723f3ad199eb851c1 scottjehl committed Sep 21, 2011
Showing with 8 additions and 17 deletions.
  1. +8 −17 js/jquery.mobile.media.classes.js
@@ -68,25 +68,16 @@ $.mobile.addResolutionBreakpoints = function( newbps ) {
detectResolutionBreakpoints();
};
-/* on mobileinit, add classes to HTML element
- and set handlers to update those on orientationchange and resize
-*/
-$( document ).bind( "mobileinit.htmlclass", function() {
- // bind to orientationchange and resize
- // to add classes to HTML element for min/max breakpoints and orientation
-
- var ev = $.support.orientation;
+/* add classes to HTML element and set handlers to update those on orientationchange and resize */
+$window.bind( "orientationchange.htmlclass throttledresize.htmlclass", function( event ) {
- $window.bind( "orientationchange.htmlclass throttledresize.htmlclass", function( event ) {
-
- // add orientation class to HTML element on flip/resize.
- if ( event.orientation ) {
- $html.removeClass( "portrait landscape" ).addClass( event.orientation );
- }
+ // add orientation class to HTML element on flip/resize.
+ if ( event.orientation ) {
+ $html.removeClass( "portrait landscape" ).addClass( event.orientation );
+ }
- // add classes to HTML element for min/max breakpoints
- detectResolutionBreakpoints();
- });
+ // add classes to HTML element for min/max breakpoints
+ detectResolutionBreakpoints();
});
/* Manually trigger an orientationchange event when the dom ready event fires.

0 comments on commit 38d7ad8

Please sign in to comment.