I created a gallery and I would like it to only appear the first two lines, and the rest would be hidden, so when the person rolled the scroll
of the mouse, appearing the others, until the end, only then when get to the end of the gallery start page scrolling indeed.
I tried creating a class involving the gallery and applying a overflow-x: auto
and a max-height
, but it was kind of strange, it only works if the mouse is over the gallery area, and when I want to scroll the page I try to take it the mouse to another area of the page.
This gray part below is simulating the footer, it would be cool when you were scrolling the page, there would appear a 150px of the footer there would start the gallery scrolling.
Did you understand?
.galeria {
float: left;
width: 100%;
overflow-x: auto;
max-height: 240px;
}
.galeria ul {
list-style: none;
float: left;
width: 100%;
}
.galeria li {
float: left;
width: 20%;
padding: 1px;
}
.galeria img {
width: 100%;
height: auto;
}
.rodape {
float: left;
width: 100%;
height: 300px;
background: #7f8c8d;
margin-top: 30px;
}
<div class="galeria">
<ul>
<li>
<img src="http://placehold.it/200x150/1abc9c/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/2ecc71/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/3498db/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/9b59b6/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/34495e/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/34495e/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/9b59b6/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/3498db/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/2ecc71/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/1abc9c/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/1abc9c/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/2ecc71/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/3498db/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/9b59b6/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/34495e/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/34495e/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/9b59b6/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/3498db/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/2ecc71/ffffff"alt="">
</li>
<li>
<img src="http://placehold.it/200x150/1abc9c/ffffff"alt="">
</li>
</ul>
</div>
<div class="rodape"></div>