iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
this.options.iconpos : undefined,
theme = $.mobile.listview.prototype.options.theme, /* Get current theme */
- style = $controlbar.attr( "data-style" );
+ style = $controlbar.attr( "data-style" ),
+ ww = window.innerWidth || $( window ).width(),
+ wh = window.innerHeight || $( window ).height(),
+ isLandscape;
+
+ isLandscape = ww > wh && ( ww - wh );
+
+ if ( isLandscape ) {
+ $controlbar.removeClass( "ui-portrait-controlbar" ).addClass( "ui-landscape-controlbar" );
+ } else {
+ $controlbar.removeClass( "ui-landscape-controlbar" ).addClass( "ui-portrait-controlbar" );
+ }
if ( style === "left" || style === "right" ) {
$controlbar
}
footer_filter
.css( "position", "fixed" )
- .css( "height", controlbar_filter.height() )
- .css( "top", window.innerHeight - footer_filter.height() );
+ .css( "bottom", 0 )
+ .css( "height", controlbar_filter.height() );
if ( style == "toolbar" ) {
controlbar_filter
- .css( "width", window.innerWidth - controlbar_filter.siblings(".ui-btn").width() );
+ .css( "width", window.innerWidth - controlbar_filter.siblings(".ui-btn").width() - parseInt(controlbar_filter.siblings(".ui-btn").css("right"), 10) * 2 );
}
}
});
$( document ).bind( "pageshow", function ( e, ui ) {
- var controlbar_filter = $( ".ui-page" ).find( ":jqmData(role='footer')" ).eq( 0 ).find( ":jqmData(role='controlbar')" ),
+ var controlbar_filter = $( ".ui-page-active" ).find( ":jqmData(role='footer')" ).eq( 0 ).find( ":jqmData(role='controlbar')" ),
+ element_width = 0,
element_count = controlbar_filter.find( 'li' ).length;
if ( controlbar_filter.find(".ui-btn-active").length == 0 ) {
.css( "width", controlbar_filter.width() )
.css( "height", controlbar_filter.height() );
}
+
+ if ( controlbar_filter.length ) {
+ element_width = Math.floor( controlbar_filter.outerWidth() / element_count );
+ controlbar_filter.find("li:last").width( controlbar_filter.outerWidth() - element_width * ( element_count - 1 ) );
+ }
});
+
+ $( window ).bind( "resize", function ( e ) {
+ var controlbar_filter = $( ".ui-page-active" ).find( ":jqmData(role='footer')" ).eq( 0 ).find( ":jqmData(role='controlbar')" ),
+ element_width = 0,
+ element_count = controlbar_filter.find( 'li' ).length;
+
+ if ( controlbar_filter.length ) {
+ element_width = Math.floor( controlbar_filter.outerWidth() / element_count );
+ controlbar_filter.find("li:last").width( controlbar_filter.outerWidth() - element_width * ( element_count - 1 ) );
+ }
+ });
+
+ this._bindControlbarEvents();
+ },
+
+ _bindControlbarEvents: function () {
+ var $controlbar = this.element;
+
+ $( window ).bind( "orientationchange", function ( e, ui ) {
+ ww = window.innerWidth || $( window ).width();
+ wh = window.innerHeight || $( window ).height();
+
+ isLandscape = ww > wh && ( ww - wh );
+
+ if ( isLandscape ) {
+ $controlbar.removeClass( "ui-portrait-controlbar" ).addClass( "ui-landscape-controlbar" );
+ } else {
+ $controlbar.removeClass( "ui-landscape-controlbar" ).addClass( "ui-portrait-controlbar" );
+ }
+ })
+
},
_setDisabled: function ( value, cnt ) {