-1
There’s a way for me to do the code below, which is in Jquery, but with CSS?
$(document).scroll(function() {
if ( $(this).scrollTop() > $(window).height() ) {
$("section#topo").css("height", "10vh");
$("section#topo").css("background", "#999");
} else {
$("section#topo").css("height", "7vh");
$("section#topo").css("background", "none");
}
});
The idea would be something like:
<style>
calc (body.scrollTop > window.height) {
section#topo {
height: "10vh";
background: #999;
}
}
calc (body.scrollTop <= window.height) {
section#topo {
height: "7vh";
background: none;
}
}
</style>
I don’t understand why the negatives are a valid question. But to answer: no, not that way. As simple as it is you’ll have to use a little JS.
– Renan Gomes
@Renangomes, Thanks for the support. I don’t have much experience with CSS. But I figured there was a way around this problem! I researched a lot before posting the question and found nothing. Who knows anyone here j[a has gone through this and found a solution. On the negatives, call no! Only serve to disturb those who have less knowledge and can not even formulate your question!
– Carlos Rocha