Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
scroll to top of iframe when unhidden

I have an iframe that is hidden on load. I have 2 divs one to unhide and another to hide the iframe and they work fine. What I'm trying to achieve is once Iframe is unhidden then the user scrolls on the iframe then clicks on hide the iframe hides but the next time the user clicks on unhide the iframe is on the last scrolled position how can I make it so that when user clicks unhide the iframe scrolls to top position before getting viewed. Thanks in advance.

$('.unhide').on('click', function() {
  //something like this
  $('.iframeCon iframe').scrollTop(0);
  
  $('.iframeCon').show()
})

$('.hide').on('click', function() {
  $('.iframeCon').hide()
})
.iframeCon {
  display: none;
  width: 100%;
  height: 90vh;
  margin-top: 7%;
  z-index: 2;
  background-color: gold;
}

iframe {
  width: 100%;
  height: 100%;
}

div:hover {
  cursor: pointer;
  text-decoration: underline;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="hide">hide</div>
<div class="unhide">unhide</div>

<div class="iframeCon">
  <iframe src="https://wix.com"></iframe>
</div>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda