1
I created a gallery and I would like it to only appear the first two lines, and the rest to remain hidden, so when the person rolls the scroll
mouse, were appearing the others, until the end, only then when you reach the end of the gallery start scrolling the page in fact.
I tried creating a class involving the gallery and applying a overflow-x: auto
and a max-height
, but it got kind of weird, it only works if the mouse is over the gallery area, and when I want to scroll the page I try to take the mouse to another area of the page.
This gray part below is simulating the footer, it would be nice when you are rolling the page, then it appears some 150px of the footer then start scrolling the gallery.
You can understand that?
.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>
Thanks mark, almost worked, however in the project I want to implement this has a content before this gallery, with this code the scrolling of the page was stuck
– Sérgio Machado