Does anyone know how Pinterest.com's layout works?

前端 未结 8 1160
时光说笑
时光说笑 2020-12-13 15:06

On http://pinterest.com/ there are \'pins\' ie

s of varying height but they all seem to render very well with no \'gaps\' or line breaks to interrupt the flow. Is
8条回答
  •  孤城傲影
    2020-12-13 15:08

    Andrews answer is amazing! I was searching for a solution and finally got it... As Andrew wrote by positioning.. Here my JS snippet. Not perfect, but the right direction. Thanks Andrew!

    var tilename = 6;
    
    for (var i = 0; i < document.querySelectorAll('#tiles .t').length; i++) { 
        document.getElementsByClassName("t"+tilename)[0].style.top = document.getElementsByClassName("t"+(tilename-5))[0].offsetHeight + 10;
        tilename += 1;
    }
    

提交回复
热议问题