I am a bit new to programming and this is a complicated problem for me.
I am building a site and I am making it fully responsive (http://www.metagame.gg/champions/azir)
I want to display a "Read more" button if the content of a div is higher than 80px
This is an example:
As we can see, the middle Div doesn't display the "Read more" button because there isn't more content to show.
To do this, I use this jquery code, where .expandClicker is the class of the button.
jQuery('.expandClicker').each(function(){
if ( jQuery(this).parent().height() < 80 ) {
jQuery(this).css({'display':'none'});
}
});
This works great, however, it can't be used when the viewport is smaller than 980px because the page changes and the parent becomes a hidden div. So the jquery code detects that the parent div height is 0px even tho it isn't, so the "Read more" button is never displayed.
The page for screens smaller than 980px:
Once the div is expanded, the "Read more" buttons don't appear because the parent div height was 0px.
Thank you very much in advance