I am trying to show item list in a div of my home page.
Home.html :
<div>
<div id="header">
<div class="header-left">
Item
</div>
<div class="header-center">Load More</div>
<div class="header-right"></div>
<div class="header-line"></div>
</div>
<div id="containeritem">
<!-- Here I want to write item list -->
</div>
</div>
css :
.containeritem{
float: left;
height: 100%;
position: relative;
width: 800px;
}
.itemTemplate {
border: 1px solid #dddddd;
float: left;
margin-bottom: 8px;
margin-left: 8px;
width: 190px;
}
Home View :
render : function(){
var itemCollection = new ItemCollection(itemlistdata);
var itemListView = new ItemListView({collection : itemCollection, el : '#containeritem'});
itemListView.render();
}
ItemList View :
var ItemListView = Backbone.View.extend({
initialize: function(){
},
render: function(){
this.collection.each(function(_itemData){
var itemView = new ItemView({model : _itemData});
this.$el.append(itemView.el);
},this);
}
});
return ItemListView;
Item View :
var ItemView = Backbone.View.extend({
initialize: function() {
this.render();
},
className : 'itemTemplate',
render: function(){
var _item = _.template(ItemTem);
this.$el.html(_item(this.model.toJSON()));
}
});
return ItemView;
Item Template :
<div>
<div class="itemCorner"> </div>
<div class="itemBrand">
<img src="<%=Path + BrandImage%>">
</div>
<div class="itemImg">
<img src="<%=Path + PictureName%>">
</div>
</div>
<div class="bottomRow" style="bottom: 0;height: 90px;">
<div class="itemName">
<%=Name%>
</div>
<div class="itemPrice">
<%=PriceShow%>
</div>
</div>
Each column is an
ItemView
and combine together byItemListView
.height of container and each item are set to
100%
I've tried this solution : CSS - Expand float child DIV height to parent's height , but each column of mine will stick together, it is not what I want.
What I want is to set these column's height to be equal to the tallest height of the items; since the content of each div is dynamically generated, I can not make it.
Any help would be appreciated. Please excuse my ignorance if I've completely missed something here.