Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

495
Views
JS style.transform translate no responde en CSS

Estoy tratando de vincular un style.transform = translate al scroll pero no funciona. Otros atributos están respondiendo. Estaría encantado de cualquier apoyo :)

 window.addEventListener('scroll', () => { let y = 1 + (window.scrollY || window.pageYOffset) / 20; y = y < 1 ? 1 : y; // ensure y is always >= 1 (due to Safari's elastic scroll) position = '"translate(0,' + '-' + y + 'vh)"' document.getElementById("marqueeup").style.transform = position; })
 #marqueeup { width: 200px; height: 100px; background-color: red; } #placeholder{ width: 100px; height: 600px; background-color: blue; }
 <div id="marqueeup"></div> <div id="placeholder"></div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Eliminar las comillas dobles.

use position = 'translate(0,' + '-' + y + 'vh)'

O incluso mejor, use literales de plantilla para que

 position = `translate(0,-${y}vh)` 

 window.addEventListener('scroll', () => { let y = 1 + (window.scrollY || window.pageYOffset) / 20; y = y < 1 ? 1 : y; // ensure y is always >= 1 (due to Safari's elastic scroll) const position = `translate(0,-${y}vh)`; document.getElementById("marqueeup").style.transform = position; })
 #marqueeup { width: 200px; height: 100px; background-color: red; } #placeholder { width: 100px; height: 600px; background-color: blue; }
 <div id="marqueeup"></div> <div id="placeholder"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!