Skip to content

Commit 38d7ad8

Browse files
author
scottjehl
committed
binding these at mobileinit didn't help anything, and only hurt the ability to use them when jQM is dynamically appended. Idea credit to @martynsmith
1 parent 5fe78d5 commit 38d7ad8

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

js/jquery.mobile.media.classes.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,16 @@ $.mobile.addResolutionBreakpoints = function( newbps ) {
6868
detectResolutionBreakpoints();
6969
};
7070

71-
/* on mobileinit, add classes to HTML element
72-
and set handlers to update those on orientationchange and resize
73-
*/
74-
$( document ).bind( "mobileinit.htmlclass", function() {
75-
// bind to orientationchange and resize
76-
// to add classes to HTML element for min/max breakpoints and orientation
77-
78-
var ev = $.support.orientation;
71+
/* add classes to HTML element and set handlers to update those on orientationchange and resize */
72+
$window.bind( "orientationchange.htmlclass throttledresize.htmlclass", function( event ) {
7973

80-
$window.bind( "orientationchange.htmlclass throttledresize.htmlclass", function( event ) {
81-
82-
// add orientation class to HTML element on flip/resize.
83-
if ( event.orientation ) {
84-
$html.removeClass( "portrait landscape" ).addClass( event.orientation );
85-
}
74+
// add orientation class to HTML element on flip/resize.
75+
if ( event.orientation ) {
76+
$html.removeClass( "portrait landscape" ).addClass( event.orientation );
77+
}
8678

87-
// add classes to HTML element for min/max breakpoints
88-
detectResolutionBreakpoints();
89-
});
79+
// add classes to HTML element for min/max breakpoints
80+
detectResolutionBreakpoints();
9081
});
9182

9283
/* Manually trigger an orientationchange event when the dom ready event fires.

0 commit comments

Comments
 (0)