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

114
Views
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
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!