mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
moved orientationchange event trigger over to media js file. Cleaned up event bindings where orientation and breakpoint classes are applied.
This commit is contained in:
parent
82c48b2311
commit
e7269f4df2
2 changed files with 17 additions and 12 deletions
|
|
@ -581,9 +581,6 @@
|
|||
//trigger a new hashchange, hash or not
|
||||
$window.trigger( "hashchange", [ true ] );
|
||||
|
||||
//update orientation
|
||||
$window.trigger( "orientationchange.htmlclass" );
|
||||
|
||||
//remove rendering class
|
||||
$html.removeClass('ui-mobile-rendering');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -86,16 +86,24 @@ $.mobile.addResolutionBreakpoints = function( newbps ){
|
|||
}
|
||||
resolutionBreakpoints.sort(function(a,b){ return a-b; })
|
||||
detectResolutionBreakpoints();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* bind to orientationchange, resize, and mobileinit
|
||||
to add classes to HTML element for min/max breakpoints and orientation */
|
||||
$window.bind( "orientationchange.htmlclass resize.htmlclass mobileinit.htmlclass", function( event ) {
|
||||
//add orientation class to HTML element on flip/resize.
|
||||
$html.removeClass( "portrait landscape" ).addClass( event.orientation );
|
||||
//add breakpoint classes for min/max widths
|
||||
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 */
|
||||
$window.bind("orientationchange.htmlclass resize.htmlclass", function(event){
|
||||
//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();
|
||||
});
|
||||
|
||||
//trigger event manually
|
||||
$window.trigger( "orientationchange.htmlclass" );
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Loading…
Reference in a new issue