I am working on a website that features 3 images, each of which opens a collapse below with an embedded iframe website inside when clicked. I am trying to implement a function where the site automatically scrolls down to the opened iframe when an image is clicked. So far, I have only found solutions for accordions.
The iframes display a 3D tour, and I want to ensure that only one tour is visible at a time. To demonstrate this concept, I have created a basic demonstration using placeholder images and a single tour link: https://codepen.io/jvern22/pen/BGzgjw
Here is a snippet of my code depicting an image linking to an iframe; there are three instances of this structure:
<div class="col-md-4 port-item">
<a href="" class="" data-toggle="collapse" data-target="#tour-duqesa">
<img src="assets/img/duqesa.jpg" alt="">
</a>
<h2 class="section-title-nomargin features-box">Duquesa</h2>
<h5 class="options-text"><a href="assets/tours/duquesashorttour/index.html" class="" target="_blank">Open in new window</h5></a>
</div>
Below is the code for the iframe element, replicated thrice to correspond with each image:
<div id="tour-duqesa" class="collapse">
<iframe height="600px" width="100%" src="assets/tours/duquesashorttour/index.html" name="iframe"></iframe>
</div>
I am still relatively new to coding, so I hope I have articulated my query effectively.