How to effect text as soon as the user scrolls the page

Asked

Viewed 58 times

0

Wanted to put the effect when it user was going down the texts in the div appear going up, here’s a site I wanted to put this function

HTML

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <title>Pagina inicial</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="estilo.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
</head>
<body onload="carregaCarrousel()">
    <header>
        <nav>
            <div class="conteudo">
                <ul class="navegacao">
                    <li class="ativo"><a href="">Inicio</a></li>
                    <li><a href="">Contato</a></li>
                    <li><a href="">Consultar preços</a></li>
                </ul>
            </div>
        </nav>
    </header>
    <section>
        <div class="conteudo espacamento">
            <div class="carrousel">
                <div class="carrousel-conteudo ativado">
                    <img class="img-carrousel" src="1.jpg">
                </div>
                <div class="carrousel-conteudo">
                    <img class="img-carrousel" src="2.jpg">
                </div>
                <div class="carrousel-conteudo">
                    <img class="img-carrousel" src="3.jpg">
                </div>
                <div>
                    <button><i class="fas fa-arrow-left"></i></button>
                    <button> <i class="fas fa-arrow-right"></i></button>
                </div>
            </div>
        </div>
    </section>

    <section>
        <div class="conteudo espacamento">
            <h2 class="titulo-relato">Relatos dos clientes</h2> 
            <div class="flex-conteudo">
                <div class="caixa">
                    <h3 class="subtitulo-relato">Cliente Lorem ipsum</h3>
                    <p class="texto-formatado">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                    </p>
                </div>
                <div class="caixa">
                    <figure>
                        <img class="img-fluida" src="4.jpg">
                    </figure>
                </div>
            </div>
            <div class="flex-conteudo">
                <div class="caixa">
                    <figure>
                        <img class="img-fluida" src="4.jpg">
                    </figure>
                </div>
                <div class="caixa">
                    <h3 class="subtitulo-relato">Cliente Lorem ipsum</h3>
                    <p class="texto-formatado">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                    </p>
                </div>
            </div>
            <div class="flex-conteudo">
                <div class="caixa">
                    <h3 class="subtitulo-relato">Cliente Lorem ipsum</h3>
                    <p class="texto-formatado">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                    </p>
                </div>
                <div class="caixa">
                    <figure>
                        <img class="img-fluida" src="4.jpg">
                    </figure>
                </div>
            </div>
        </div>
    </section>
    <section>
        <div class="conteudo espacamento">
            <h2 class="titulo-relato">Nossos Preços</h2>    
            <div class="flex-conteudo">
                <div class="preco">
                    <h3 class="titulo-preco">Lorem ipsum dolor<</h3>
                    <ul>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                    </ul>
                    <button class="botao">Veja mais</button>
                </div>
                <div class="preco">
                    <h3 class="titulo-preco">Lorem ipsum dolor</h3>
                    <ul>
                        <li>Lorem ipsum dolor </li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                    </ul>
                    <button class="botao">Veja mais</button>
                </div>
                <div class="preco">
                    <h3 class="titulo-preco">Lorem ipsum dolor</h3>
                    <ul>
                        <li>Lorem ipsum dolor </li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                        <li>Lorem ipsum dolor</li>
                    </ul>
                    <button class="botao">Veja mais</button>
                </div>
            </div>
        </div>
    </section>

    <footer>
        <div class="conteudo">
            <ul class="navegacao">
                <li><a href=""><i class="fab fa-facebook-square"></i> Facebook</a></li>
                <li><a href=""><i class="fab fa-instagram"></i> Instaram</a></li>
                <li><a href=""><i class="fab fa-twitter"></i> Yotube</a></li>
            </ul>
        </div>
    </footer>

    <script type="text/javascript" src="app.js"></script>
</body>
</html>

CSS

*{padding: 0;margin: 0;}

body{
    background-color:#F2F2F2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

ul{
    list-style: none;
    margin: 0;
    padding: 0;
}

.conteudo{
    width: 90%;
    /*border: 1px solid red;*/
    margin: 0 auto;
}

.navegacao{
    overflow-x: auto;
    background-color: #B33B3B;
    /*#9C1B1B*/

}

.navegacao li{
    float: left;
    /*margin-left: 300px;*/
}

.navegacao a{
    text-decoration: none;
    display: block;
    padding: 14px 16px;
    color: white;
    /*text-align: right;*/
    text-align: left;
}

.ativo{
    background-color: #7B3939;
}

.img-carrousel{
    width: 100%;
}

.carrousel-conteudo{
    display: none;
}

.ativado{
    display: block;
}

.flex-conteudo{
    display: flex;
    flex-direction: row;
     align-items: flex-start;
}

.caixa{
    width: 50%;
    /*background-color: red;*/
    /*margin-right: 30px;*/
}

.img-fluida{
    width: 100%;
}

.texto-formatado{
    text-align: justify;
    text-indent: 20px;
    margin-right: 10px;
}

.subtitulo-relato{
     font-size: 2.5rem;
    font-weight: 300;
    /*line-height: 1.2em;*/
}

.espacamento{
    margin-top: 30px;
    margin-bottom: 30px;
}

.titulo-relato{
    font-size: 3.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.preco{
    width: 33.3%;
    margin: 10px;
    text-align: center;
}

.titulo-preco{
    background-color: #D8D8D8;
    padding: 10px;
    font-weight: 400; 
    text-align: center;
}

.botao{
    padding: 10px;
    border-radius: 10px;
    border: none;
    width: 100%;
    background-color: #fff;
    border-color: ;
    color: #693623;
    margin-top: 10px;
    outline: none;
    cursor: pointer;
    display: block;
    border: 1px solid #693623;
}

.botao:hover{
    background-color: #693623;
    color: white;
}

@media (max-width: 900px){
    .caixa, .preco,.conteudo{
        width: 100%;
        margin: 0;
        /*border: 1px solid red;*/
    }
    .flex-conteudo{
        flex-direction: column;
    }
    .caixa img{
        display: none;
    }
    .caixa{
        margin-bottom: 10px;
    }
}

1 answer

2


You can easily do this using the wow.js and Animate.css libraries

Browser other questions tagged

You are not signed in. Login or sign up in order to post.