我想在同位素网格中调整一些元素的大小。
我不希望每次调整窗口大小时都会发生这种情况。我只是想要它在同位素的重新布局功能之前。
有没有办法我可以做到这一点?在重新布局之前有任何回调吗?
谢谢!
我想在同位素网格中调整一些元素的大小。
我不希望每次调整窗口大小时都会发生这种情况。我只是想要它在同位素的重新布局功能之前。
有没有办法我可以做到这一点?在重新布局之前有任何回调吗?
谢谢!
我找到了一个方法。我已经在使用 Centered Masonry 模式扩展同位素。在扩展的调整大小功能中,我对同位素元素进行了调整大小的更改,然后触发了调整大小(不确定这是否是正确的方法),这就成功了。
现在每次同位素想要重新布局,就在它之前,我调整元素的大小!
这是代码:
$.Isotope.prototype._masonryResizeChanged = function () {
            //  Resize elements
            //Code that sets a new width for all elements
            // Force a relayout
            $('#container').isotope( 'reLayout');
            //Rest of the overriden method
            var prevColCount = this.masonry.cols;
            // get updated colCount
            this._getCenteredMasonryColumns();
            return ( this.masonry.cols !== prevColCount );
        };