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

88
Views
Cambié mis cargadores de PHP de jQuery a Fetch y ahora ninguno de mis JS funciona con ellos

Cambié todos mis cargadores de jQuery a Fetch y ahora ninguno de los controles deslizantes funciona, pero las diapositivas se muestran correctamente en el DOM. Parece que no puedo apuntarlos con JS.

https://www.harpercollege.edu/dev/whoward-dev-area/dev-index.php

 fetch('/_resources/php/dev-home-interrupter-loader.php')
 .then(function(response) {
 return response.text();
 })
 .then(function(body) {
 document.querySelector('#home-interrupter').innerHTML = body;
 });

 const interrupterslidesContainer = document.getElementById("interrupter-slides-container");
 const interrupterslide = document.querySelector(".interrupter-slide");
 const previnterrupter = document.getElementById("interrupter-slide-arrow-prev");
 const nextinterrupter = document.getElementById("interrupter-slide-arrow-next");

 nextinterrupter.addEventListener("click", () => {
 const interrupterslideWidth = interrupterslide.clientWidth;
 interrupterslidesContainer.scrollLeft += interrupterslideWidth;
 });

 previnterrupter.addEventListener("click", () => {
 const interrupterslideWidth = interrupterslide.clientWidth;
 interrupterslidesContainer.scrollLeft -= interrupterslideWidth;
 });
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Su código se ejecuta incluso antes de que comience la búsqueda

 fetch('/_resources/php/dev-home-interrupter-loader.php')
 .then(function(response) {
 return response.text();
 })
 .then(function(body) {
 document.querySelector('#home-interrupter').innerHTML = body;
 })
 .then(() => {
 const interrupterslidesContainer = document.getElementById("interrupter-slides-container");
 const interrupterslide = document.querySelector(".interrupter-slide");
 const previnterrupter = document.getElementById("interrupter-slide-arrow-prev");
 const nextinterrupter = document.getElementById("interrupter-slide-arrow-next");

 nextinterrupter.addEventListener("click", () => {
 const interrupterslideWidth = interrupterslide.clientWidth;
 interrupterslidesContainer.scrollLeft += interrupterslideWidth;
 });

 previnterrupter.addEventListener("click", () => {
 const interrupterslideWidth = interrupterslide.clientWidth;
 interrupterslidesContainer.scrollLeft -= interrupterslideWidth;
 });
})

almost 4 years ago · Santiago Trujillo 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!