added masonry to popular page
This commit is contained in:
parent
76a38878ba
commit
9e666945e0
5 changed files with 55 additions and 2 deletions
|
@ -528,3 +528,13 @@ table {
|
|||
.wrap-words {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/* ---- grid items ---- */
|
||||
|
||||
.grid-item {
|
||||
width: calc(30% - 2rem);
|
||||
padding: 0px;
|
||||
margin: 1rem;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
7
public/assets/vendors/imagesloaded/imagesloaded.pkgd.min.js
vendored
Normal file
7
public/assets/vendors/imagesloaded/imagesloaded.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
public/assets/vendors/masonry/masonry.pkgd.min.js
vendored
Normal file
9
public/assets/vendors/masonry/masonry.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
views/partials/gridItem.handlebars
Normal file
7
views/partials/gridItem.handlebars
Normal file
|
@ -0,0 +1,7 @@
|
|||
<a href="{{this.showUrlLong}}">
|
||||
{{#ifConditional this.contentType '===' 'video/mp4'}}
|
||||
<img class="content-list-item-asset grid-item" src="{{this.thumbnail}}"/>
|
||||
{{else}}
|
||||
<img class="content-list-item-asset grid-item" src="{{this.directUrlLong}}" />
|
||||
{{/ifConditional}}
|
||||
</a>
|
|
@ -1,6 +1,26 @@
|
|||
<div class="row">
|
||||
<div class="row grid">
|
||||
{{#each trendingAssets}}
|
||||
{{> contentListItem}}
|
||||
{{> gridItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
<script src="/assets/vendors/masonry/masonry.pkgd.min.js"></script>
|
||||
<script src="/assets/vendors/imagesloaded/imagesloaded.pkgd.min.js"></script>
|
||||
<script>
|
||||
// init masonry with element
|
||||
var grid = document.querySelector('.grid');
|
||||
var msnry;
|
||||
|
||||
imagesLoaded( grid, function() {
|
||||
msnry = new Masonry( grid, {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: 3,
|
||||
percentPosition: true
|
||||
});
|
||||
});
|
||||
|
||||
// init with selector
|
||||
// var msnry = new Masonry( '.grid', {
|
||||
// // options...
|
||||
// });
|
||||
</script>
|
Loading…
Reference in a new issue