-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
d090f18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you forgot to change the
$container.children('.' + options.lastRowClass).removeClass(options.lastRowClass);
line. you do not need to find all the children again, right after you have them 3 lines before initems
variable. just use the.filter
to get the ones you need from theitems
objects.also, performance is still somewhat lagging when there are many items..this is due to too many DOM changes being made. I would recommend doing all the DOM changes on a copy of all the items, then inject them again.
you are also doing the exact SAME loop three times. combine everything into one loop. also, it's considered a bad habit to write
var
around your code. use thevar
word to initialize variables only on the top of each scope, and then use these variables where ever you wish.d090f18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are still many things to do. I will improve it from time to time.
But I can not combine the three loops into one because I would write and read every time I pass the loop. This would force the browser to layout hundreds of times (read, write, relayout, read, write, relayout,…). Therefore I first remove all styles, then I get all things I need (height, width, etc.) and finally I set the new styles to the elements. This approach only forces two relayouts.
And again: Thanks for your help!