Detecting whether there's overflow or not WITHOUT javascript
Solution for this StackOverflow question:
http://stackoverflow.com/q/7141874/613540
HTML
<div class="wrapper">
<div class="container">
<button class="addmore">Add another row</button>
<p>Lorem ipsum dolor set amet.</p>
</div>
<div class="whitewash"></div>
<p class="more"><a href="#">more...</a></p>
</div>
CSS
* {margin: 0;}
html, body {
height: 100%;
font-size: 2em;
padding: 0;
margin: 0;
}
p {
padding: 5px;
}
.wrapper {
height: 100%;
position: relative;
overflow: hidden;
}
.container {
background-color: transparent;
}
.whitewash {
position: relative;
height: 2000px;
background-color: white;
z-index: 2;
}
.more {
position: absolute;
bottom: 0;
height: 1em;
width: 100%;
background-color: white;
z-index: 1;
}
JavaScript
/**
* JavaScript is only used for demo purposes
* To make the "Add another row" work.
**/
$(document).ready(function() {
$('.addmore').click(function(e){
$('.container').append('<p>Lorem ipsum dolor set amet.</p>');
});
});