Masonry stack from bottom up

我们两清 提交于 2019-12-12 08:28:36

问题


I'd like to stack my Masonry bricks from the bottom up.

This question was answered before, but that modification and fork of Masonry use a very old version of the script now. The newer version of Masonry has bug fixes which I needed.

So does anyone know how to apply the old solution to the newer script?

Here is the old solution.

var position = (opts.fromBottom) ? {
  left: props.colW * shortCol + props.posLeft,
  bottom: minimumY
} : {
  left: props.colW * shortCol + props.posLeft,
  top: minimumY
};

Here is a Fiddle with the newer Masonry script. I added fromBottom option at line 74. The code in question is around line 285.

This question is obsolete in the newest version of Masonry (now a standard option).


回答1:


Replace this (starting at line 287):

var position = {
  top: minimumY + this.offset.y
};

with this:

var position = (this.options.fromBottom) ? {
  bottom: minimumY + this.offset.y
} : {
  top: minimumY + this.offset.y
};

Demo




回答2:


When using stack-bond it is very important to let the masonry dry before you apply a new layer. So, best is to stack line-by-line and not first up and then to the side, so you can always control the level of the total stack. Interleaving stack bond with a layer of running bond now and then is good practice and decorative too.



来源:https://stackoverflow.com/questions/14539368/masonry-stack-from-bottom-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!