Skip to content

Instantly share code, notes, and snippets.

@philcon93
Last active January 20, 2016 00:33
Show Gist options
  • Save philcon93/0ef8a237ec8d1464aadd to your computer and use it in GitHub Desktop.
Save philcon93/0ef8a237ec8d1464aadd to your computer and use it in GitHub Desktop.
Thumbnails caption same height

Set product title height for thumbnails based on largest

JS

if($('.product-name').length > 0)
//set product title height for thumbnails based on largest
if($('.product-name').length > 0){
var maxHeight = -1;
$('.product-name').each(function() {
maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height();
});
$('.product-name').each(function() {
$(this).height(maxHeight);
});
}
<div class="caption text-center">
<h3 itemprop="name" class="product-name ">
<a href="[@URL@]" title="[@model@]">[%format type:'text' maxlength:'50' rmhtml:'1'%][@model@][%END FORMAT%]</a>
<br/><br/><span class="caption-brand">[@brand@]</a>
</h3>
<p class="price" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
[%IF [@has_child@]%]From [%END IF%]
[%IF [@inpromo@]%]
<span itemprop="price">[%format type:'currency'%][@promo_price@][%END format%]</span><small class="muted"> (was [%format type:'currency'%][@store_price@][%END format%])</small>
[%ELSE%]
<span itemprop="price">[%format type:'currency'%][@store_price@][%END format%]</span>
[%END IF%]
</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment