masonry only reloads when columncount changes
This commit is contained in:
@@ -56,14 +56,20 @@ $(window).on("load", function() {
|
||||
|
||||
var masonryMode = 0;
|
||||
var windowWidth = $(window).width();
|
||||
var oldColumnCount = Math.floor($(".posts").width() / 250);
|
||||
|
||||
|
||||
$(window).resize(function() {
|
||||
clearTimeout(window.resizedFinished);
|
||||
window.resizeFinished = setTimeout(function() {
|
||||
if ($(window).width() != windowWidth) {
|
||||
windowWidth = $(window).width();
|
||||
|
||||
if (oldColumnCount != Math.floor($(".posts").width() / 250)) {
|
||||
oldColumnCount = Math.floor($(".posts").width() / 250);
|
||||
masonry(masonryMode);
|
||||
}
|
||||
}
|
||||
}, 250);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user