Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I fix this max-height Javascript Issue or use CSS to get the same results?
    primarykey
    data
    text
    <p>I'm working with the Interspire shopping cart and there is a bit of code in common.js that controls the height of the product display boxes for things like "featured products". It makes it so all of the elements are at the same height. That makes everything look nice but this doesn't seem to work in Firefox. The product displays look great in Chrome and IE but on firefox the box heights expand to 4000+ pixels! Even more weird is that sometimes if I hit the refresh button, it fixes and shows correctly. I can hit refresh again and it's back to being messed up. Site testers are experiencing the same problem. </p> <p><img src="https://i.stack.imgur.com/v8Xp1.jpg" alt="enter image description here"></p> <p>I removed the bit of code and set the height of the boxes in the CSS file but then the elements are all of different heights and the display doesn't look very good. So I put the code back and I'm stumped. </p> <p>I'm thinking I'll have to get rid of this code and try to achieve the same result via CSS only. Is this possible? I'm unsure how to do that so that all the elements are at the same height relative to each other. </p> <p>The comment the Interpsire coder put in is that this bit of code is a 'hack job'...</p> <pre><code>// Ensure that all product lists are the same height function setProductListHeights(imgName, className) { // hack job putting this here but it needs to be reused by search ajax pager if (typeof(DesignMode) != 'undefined') { return; } if (typeof imgName != 'undefined') { if (typeof loadedImages[imgName] != 'undefined') { return; } loadedImages[imgName] = true; } setProductThumbHeight(); /** * Sets the height of the elements passed in to match that of the one that * has the greatest height. * * @param ele The element(s) to adjust the height for. * @return void */ function setHeight(ele) { var ele = $(ele), maxHeight = 0; ele // reset the height just in case it was set by the stylesheet so // we can detect it .css('height', 'auto') // get the one with the greatest height .each(function() { if ($(this).height() &gt; maxHeight) { maxHeight = $(this).height(); } }) // and set them all to the greatest height .css('height', maxHeight); } if (!className) { className = '.Content'; } setHeight(className + ' .ProductList:not(.List) li .ProductDetails'); if (typeof imgName != 'undefined') { setHeight(className + ' .ProductList:not(.List) li .ProductPriceRating:has(img[src$='+imgName+'])'); } setHeight(className + ' .ProductList:not(.List) li'); } </code></pre> <p>Thanks so much! I've been trying to fix this for a little while, particularly for some custom sales panels I created. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload