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

133
Views
Changing transform position on mouse event?

I am making an image carousel feature, I have completed the sliding with forwarding and backward buttons with transform property. But now I am facing problems doing it perfectly with mouse events like when the mouse is clicked and dragged to left then making a smooth and user-friendly image carousels. How can I do it?

Here is the example code: - https://jsfiddle.net/dy1vk40f/1/

Any guide provided would be greatly appreciated

function moveable(e) {
  if(!isDown) return;
  e.preventDefault();
  
  const x = e.pageX - scrollcontainer.offsetLeft;
  const style = window.getComputedStyle(scrollcontainer);
  const matrix = new WebKitCSSMatrix(style.transform);

  const walk = x - startX;
  const walktwo = walk * 10;
  scrollcontainer.style.userSelect = 'none';
  scrollcontainer.style.transform = `translate3d(${matrix.m41 + walk}px, 0px, 0px)`;
  startX = e.pageX;
  texx.innerHTML = `Tranlate: ${matrix.m41}`;
about 4 years ago · Juan Pablo Isaza
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!