Skip to content

Commit

Permalink
Improved performance. Fixed bug that may be have wrong height if elem…
Browse files Browse the repository at this point in the history
…ents have different property.
  • Loading branch information
urin committed Mar 1, 2014
1 parent 1236cbb commit 9491fb1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions jquery.tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* @author: Hayato Takenaka (https://github.com/urin/jquery.tile.js)
* @version: 1.0.2
* @version: 1.1.0
**/
(function($) {
$.fn.tile = function(columns) {
var tiles, $tile, max, c, h, s, a = ["height"],
last = this.length - 1, remove, height;
var tiles, $tile, max, c, h, s, remove, a = ["height"],
last = this.length - 1;
if(!columns) columns = this.length;
s = document.body.style;
remove = s.removeProperty ? s.removeProperty : s.removeAttribute;
Expand All @@ -21,14 +21,11 @@
c = i % columns;
if(c == 0) tiles = [];
$tile = tiles[c] = $(this);
height = ($tile.css("box-sizing") == "border-box") ? $.fn.outerHeight : $.fn.innerHeight;
h = height.apply($tile);
h = ($tile.css("box-sizing") == "border-box") ? $tile.outerHeight() : $tile.innerHeight();
if(c == 0 || h > max) max = h;
if(i == last || c == columns - 1) {
max = [max];
$.each(tiles, function() { height.apply(this, max); });
$.each(tiles, function() { this.css("height", max); });
}
});
};
})(jQuery);

2 changes: 1 addition & 1 deletion jquery.tile.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tile.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"layout",
"box"
],
"version": "1.0.2",
"version": "1.1.0",
"author": {
"name": "urin",
"url": "https://github.com/urin"
Expand Down

0 comments on commit 9491fb1

Please sign in to comment.