Can I make an iFrame autoscroll?

I’ve got an iFrame embedded on my page which links to a webcam page on the BBC web site. The problem is, is the user has to scroll to view the camera. Is there any way I can get the content page inside the iFrame to scroll automatically say 100 pixels down?

The framed page is on the BBC site so I obviouslly have no control over it i.e. to add anchor tags, etc.

Not the best linked source, but is this what you are referring too?

http://www.w3schools.com/TAGS/att_iframe_scrolling.asp

Hi jaspinal :slight_smile:

You would need JavaScript to scroll halfway down, or rather use a name=“oneHundredPxDown” and include that in your target of the link when calling the frame. Make sure oneHundredPxDown is about 100 pixels down.

Cheers.

This can be done very easily without the introduction of JavaScript. All you need is a simple bit of CSS trickery. Just adapt the following code as you require:

HTML

<div id='outerdiv'>
<iframe src="#" id='inneriframe' scrolling=no></iframe>
</div>

Just replace ‘#’ with your BBC link (I can’t post URLs yet!).

CSS

<style>
#outerdiv
{
width:446px;
height:246px;
overflow:hidden;
position:relative;
}

#inneriframe
{
position:absolute;
top:-100px;
left:-200px;
width:1280px;
height:1200px;
}
</style>

That should do the trick, shout up if not… :wink:

Hey thanks for the info guys! FinerHome I used your technique, superb, works a treat - just what I was after - thanks a lot!