Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
Move images based on scroll

I'm trying to create a section where I have two Images

<img class="first">
<img class="second">

the first image is left aligned and the second one is right I want to move them from right to left and left to right based on scroll When the user scrolls down images should move to the center from left and right

Here is the code pen link: https://codepen.io/taruunn/pen/RwjQrOy

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can add key at .add(). This code, I add "first".

So it will move together.

Apply the code below.

var controller = new ScrollMagic.Controller();

var scrollHorizontal = new TimelineLite()
  .add(TweenMax.to("#scrollHorizontal1", 1, {x:'-100%'}), "first")
  .add(TweenMax.to("#scrollHorizontal2", 1, {x:'100%'}), "first");

var horizontalScroll = new ScrollMagic.Scene({
  triggerElement: "#scrollHorizontal",
  triggerHook: 'onLeave',
  duration: 3000
}).setTween(scrollHorizontal).setPin("#scrollHorizontal").addTo(controller);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda