<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://npmcdn.com/masonry-layout@4.0.0/dist/masonry.pkgd.min.js "></script>
<style>
.relative-container {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
}
.container {
display: flex;
flex-wrap: wrap;
width: 80%;
margin: 0 auto
}
.box {
width: 165px; /* 按照你需要调整宽度 */
height: auto; /* 高度自适应 */
margin: 5px; /* 添加边距 */
}
#pagination {
position: absolute;
bottom: 0;
width: 100%;
margin-top: 20px;
}
</style>
<div class="relative-container">
<div id="container" class="container">
<div class="box">
<div class="pic"></div>
</div>
......
<div class="box">
<div class="pic"></div>
</div>
</div>
<div id="pagination">
<?php echo $page->showPage(); ?>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#container').masonry({
itemSelector: '.box',
columnWidth: 30,
isFitWidth: true
});
});
</script>
用jquery和masonry构建的瀑布流,为什么分页导航
总是会浮动到瀑布流上,而不是瀑布流排版后的最末端显示呢?