Skip to content

Instantly share code, notes, and snippets.

@edvakf
Created January 24, 2013 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edvakf/4626945 to your computer and use it in GitHub Desktop.
Save edvakf/4626945 to your computer and use it in GitHub Desktop.
diff --git a/htdocs/source/js/pre-login.js b/htdocs/source/js/pre-login.js
index 2835a85..d532175 100644
--- a/htdocs/source/js/pre-login.js
+++ b/htdocs/source/js/pre-login.js
@@ -183,6 +183,7 @@ var brick = {
function loop() {
var start_position = position, i = 0, width = 0, height, r = [], w = [], list, item, data, right_margin, target, current_width = 0, top;
+ var rsum = 0;
while (width < container_width) {
item = items.eq(position);
@@ -192,12 +193,13 @@ var brick = {
r[i] = data.width / data.height;
w[i] = base_height * r[i] + margin;
width += w[i];
+ rsum += r[i];
++i;
++position;
}
right_margin = width - container_width;
- height = ((w[0] - right_margin * (w[0] / width))) / r[0] - margin / r[0];
+ height = (width - i * margin - right_margin) / rsum;
items.slice(start_position, position).height(height);
target = lists.slice(start_position, position).each(function(n) {
@@ -208,13 +210,8 @@ var brick = {
left : '',
right : ''
};
- if (n === i - 1) {
- css.right = 10;
- }
- else {
- css.left = current_width;
- current_width += Math.floor(height * r[n]) + margin;
- }
+ css.left = current_width;
+ current_width += Math.floor(height * r[n]) + margin;
target.css(css);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment