Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Move Iframe When User Scrolls Down in Web Browser


whoisgregg - 10:16 pm on Aug 14, 2009 (gmt 0)


Hello tqatsju!

Basically, you'll want to set up a function to observe the window.onscroll event and, when it changes, get the position of the scroll, then move the iframe to that new position.

I use the Prototype library, so the code below should work if you have that same library. Otherwise, you can use this as pseudocode to put together your own solution. :)

Event.observe(window, 'scroll', function() {
$('iframe_id').setStyle({'position' : 'absolute', 'top' : document.body.scrollTop +'px'});
});


Thread source:: http://www.webmasterworld.com/javascript/3953015.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com