mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
547a82c44c
2 changed files with 63 additions and 56 deletions
|
|
@ -3,48 +3,51 @@
|
|||
* Copyright (c) jQuery Project
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
(function($, undefined ) {
|
||||
$.fn.grid = function(options){
|
||||
return this.each(function(){
|
||||
var o = $.extend({
|
||||
grid: null
|
||||
},options);
|
||||
|
||||
|
||||
var $kids = $(this).children(),
|
||||
*/
|
||||
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.fn.grid = function( options ) {
|
||||
return this.each(function() {
|
||||
|
||||
var $this = $( this ),
|
||||
o = $.extend({
|
||||
grid: null
|
||||
},options),
|
||||
$kids = $this.children(),
|
||||
gridCols = {solo:1, a:2, b:3, c:4, d:5},
|
||||
grid = o.grid,
|
||||
iterator;
|
||||
|
||||
if( !grid ){
|
||||
if( $kids.length <= 5 ){
|
||||
for(var letter in gridCols){
|
||||
if(gridCols[letter] == $kids.length){ grid = letter; }
|
||||
|
||||
if ( !grid ) {
|
||||
if ( $kids.length <= 5 ) {
|
||||
for ( var letter in gridCols ) {
|
||||
if ( gridCols[ letter ] === $kids.length ) {
|
||||
grid = letter;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
grid = 'a';
|
||||
} else {
|
||||
grid = "a";
|
||||
}
|
||||
}
|
||||
iterator = gridCols[grid];
|
||||
|
||||
$(this).addClass('ui-grid-' + grid);
|
||||
|
||||
$kids.filter(':nth-child(' + iterator + 'n+1)').addClass('ui-block-a');
|
||||
if(iterator > 1){
|
||||
$kids.filter(':nth-child(' + iterator + 'n+2)').addClass('ui-block-b');
|
||||
}
|
||||
if(iterator > 2){
|
||||
$kids.filter(':nth-child(3n+3)').addClass('ui-block-c');
|
||||
}
|
||||
if(iterator > 3){
|
||||
$kids.filter(':nth-child(4n+4)').addClass('ui-block-d');
|
||||
}
|
||||
if(iterator > 4){
|
||||
$kids.filter(':nth-child(5n+5)').addClass('ui-block-e');
|
||||
|
||||
$this.addClass( "ui-grid-" + grid );
|
||||
|
||||
$kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" );
|
||||
|
||||
if ( iterator > 1 ) {
|
||||
$kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" );
|
||||
}
|
||||
|
||||
});
|
||||
if ( iterator > 2 ) {
|
||||
$kids.filter( ":nth-child(3n+3)" ).addClass( "ui-block-c" );
|
||||
}
|
||||
if ( iterator > 3 ) {
|
||||
$kids.filter( ":nth-child(4n+4)" ).addClass( "ui-block-d" );
|
||||
}
|
||||
if ( iterator > 4 ) {
|
||||
$kids.filter( ":nth-child(5n+5)" ).addClass( "ui-block-e" );
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
||||
})( jQuery );
|
||||
|
|
@ -4,38 +4,42 @@
|
|||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
(function($, undefined ) {
|
||||
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.widget( "mobile.navbar", $.mobile.widget, {
|
||||
options: {
|
||||
iconpos: 'top',
|
||||
grid: null
|
||||
},
|
||||
|
||||
_create: function(){
|
||||
|
||||
var $navbar = this.element,
|
||||
$navbtns = $navbar.find("a"),
|
||||
iconpos = $navbtns.filter( ":jqmData(icon)").length ? this.options.iconpos : undefined;
|
||||
|
||||
$navbar
|
||||
.addClass('ui-navbar')
|
||||
$navbtns = $navbar.find( "a" ),
|
||||
iconpos = $navbtns.filter( ":jqmData(icon)" ).length ?
|
||||
this.options.iconpos : undefined;
|
||||
|
||||
$navbar.addClass('ui-navbar')
|
||||
.attr("role","navigation")
|
||||
.find("ul")
|
||||
.grid({grid: this.options.grid });
|
||||
|
||||
if( !iconpos ){
|
||||
$navbar.addClass("ui-navbar-noicons");
|
||||
.grid({grid: this.options.grid });
|
||||
|
||||
if ( !iconpos ) {
|
||||
$navbar.addClass( "ui-navbar-noicons" );
|
||||
}
|
||||
|
||||
$navbtns
|
||||
.buttonMarkup({
|
||||
corners: false,
|
||||
shadow: false,
|
||||
iconpos: iconpos
|
||||
});
|
||||
|
||||
$navbar.delegate("a", "vclick",function(event){
|
||||
|
||||
$navbtns.buttonMarkup({
|
||||
corners: false,
|
||||
shadow: false,
|
||||
iconpos: iconpos
|
||||
});
|
||||
|
||||
$navbar.delegate( "a", "vclick", function( event ) {
|
||||
$navbtns.not( ".ui-state-persist" ).removeClass( $.mobile.activeBtnClass );
|
||||
$( this ).addClass( $.mobile.activeBtnClass );
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
|
|
|||
Loading…
Reference in a new issue