Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
Move to top on click of button

I am using intro.js in my code to implement the walkthrough. I want to implement a sceanrio where on clicking the done button(.introjs-donebutton) the page should scroll to the top but with this code It is not happening. Can anyone please help me with this one?

//$('.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 Respostas
Responde à pergunta

0

I assume that you want to scroll the client view page to top on clicking a button. if so you can use this code

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);
    });
});

Don't Forget to add jQuery cdns to your html header file. If it's not working share your html code. we will look forward

about 4 years ago · Juan Pablo Isaza Relatório

0

Using pure javascript, no framework

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

0

So i used this and It started running fine, the reason being the button was dynamically being created after the inital page load, so this should work

  $(document).on("click", ".introjs-donebutton", function(){
    $(document).scrollTop(0);
  })
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda