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