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

144
Views
Mover a la parte superior al hacer clic en el botón

Estoy usando intro.js en mi código para implementar el tutorial. Quiero implementar un escenario en el que, al hacer clic en el botón Listo (.introjs-donebutton), la página se desplace hacia la parte superior, pero con este código no está sucediendo. ¿Puede alguien por favor ayudarme con este?

 //$('.col-new-four').attr('id','essentials'); const intro = introJs(); intro.setOptions({ steps:[ { element:'#featured_apps_2_0', intro:'welcome' }, { element:'#myTopnav', intro:'Quickly access the apps and portals you need on and off the clock.' }, { element:'.slideshow-container', intro:'This space features topics you care about the most.' }, { element:'.card', intro:'Stay up-to-date on trending stories.' }, { element:'#stepextra', intro:'View your recommended and favorite pages.' }, { element:'#step4', intro:'Find promotional content, latest additions and more here.' }, { element:'#essentials2', intro:'Learn about what's trending with your favorite topics.' }, { element:'.col-new-7525', intro:'Explore benefits, tools and new features available to you.' } ] }) $('.introjs-donebutton').click(function() { $(window).scrollTop(0); }); function callintro(){ intro.start(); console.log("called intro") }
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/4.2.2/intro.min.js"></script>

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

0

Supongo que desea desplazar la página de vista del cliente hacia arriba al hacer clic en un botón. si es así puedes usar este código

HTML

 <div class="button-parent"> <button type="button" class="button-to-top">Click Here</button> </div>

jQuery

 $(document).ready(function () { $('.button-to-top').on('click', function () { $('body').scrollTop(0); }); });

No olvide agregar jQuery cdns a su archivo de encabezado html. Si no funciona, comparte tu código html. estaremos atentos

about 4 years ago · Juan Pablo Isaza Report

0

Usando javascript puro, sin marco

 window.scrollTo({ top: 0, behavior: 'smooth' })
about 4 years ago · Juan Pablo Isaza Report

0

Entonces usé esto y comenzó a funcionar bien, la razón es que el botón se creaba dinámicamente después de la carga de la página inicial, por lo que debería funcionar

 $(document).on("click", ".introjs-donebutton", function(){ $(document).scrollTop(0); })
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!