2
How do I when scrolling the page increase the size of the text?
I would like each 50px
the text increased in 10px
to scroll the page to a total of 1000px
top-down.
Below is Fiddle and Snippet:
$(document).ready(function(){
$(window).scroll(function() {
if ($(document).scrollTop() > 50) {
$(".texto").addClass("t1");
} else {
$(".texto").removeClass("t1");
}
if ($(document).scrollTop() > 100) {
$(".texto").removeClass("t1");
$(".texto").addClass("t2");
} else {
$(".texto").removeClass("t2");
}
if ($(document).scrollTop() > 150) {
$(".texto").removeClass("t1");
$(".texto").removeClass("t2");
$(".texto").addClass("t3");
} else {
$(".texto").removeClass("t3");
}
if ($(document).scrollTop() > 200) {
$(".texto").removeClass("t1");
$(".texto").removeClass("t2");
$(".texto").removeClass("t3");
$(".texto").addClass("t4");
} else {
$(".texto").removeClass("t4");
}
});
});
* {
margin: 0;
padding: 0;
color: #0096FF;
}
.texto {
padding-top: 10%;
}
body {
height: 5000px;
}
.t1 {
font-size: 46px;
}
.t2 {
font-size: 56px;
}
.t3 {
font-size: 66px;
}
.t4 {
font-size: 76px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Teste</title>
</head>
<body>
<h1 class="text-center texto fixed-top">Teste</h1>
</body>
</html>
Voce can use javascript to do this.. domina JS?
– Luís Almeida
basic knowledge of jquery.
– Lucas Simao
I tried to do it and I managed to put the code
– Lucas Simao
can put here the code. we can try to optimize.
– Luís Almeida
I’m new here as I do it?
– Lucas Simao
click on
editar
then click on{}
and put the code– isaque
@Lucassimao Create an https://jsfiddle.net/ and click save and then send the link
– I_like_trains