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

196
Views
CommonJS No puedo desmarcar la casilla de verificación

Intenté desplazar automáticamente mi div, pero quería agregar una casilla de verificación para que los usuarios puedan seleccionar este evento (desplazarse o no)

Utilicé la declaración If pero no funciona, si se verifica una vez, siempre devuelva mi función para desplazarse automáticamente por mi ventana de chat.

aquí está mi código

 const chat_win = document.getElementById('chat-window') const autoscroll = document.getElementById('autoscroll') autoscroll.onchange = function() { checked = autoscroll.checked; console.log(checked); if(checked == true) pageScroll() else return; } function pageScroll() { chat_win.scrollBy(0, 5); scrolldelay = setInterval(pageScroll, 10); }

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

0

 // every second white to chat setInterval( function() { let d = document.createElement( "div" ); d.innerText = new Date().toGMTString(); document.getElementById( "chat_window" ).appendChild( d ); }, 1000 ); var chat_window_scroll_interval; document.getElementById( "autoscroll_chbx" ).addEventListener( "change", function() { // this == checkbox if ( this.checked ) { // scroll every 1 second by 40px vertically chat_window_scroll_interval = setInterval( function() { document.getElementById( "chat_window" ).scrollBy( 0, 40 ); }, 1000 ); } else { clearInterval( chat_window_scroll_interval ); } } );
 #chat_window { height: 200px; max-height: 200px; width: 200px; overflow-y: auto; }
 <div id="chat_window"></div> <input type="checkbox" id="autoscroll_chbx" />

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!