Reputation: 11
I cannot get scroll to work, here is the complete stuff: http://zed.mit.edu/scroll2/buc.php
I'm trying to refresh the page while maintaining the scroll position of the iframe inside.
I'd like to have an alert when I actively scroll the iframe, these two both fail:
$(top).frames['#iframe_bucinid'].scroll(function() ....
$('#iframe_bucinid').scroll(function() ...
The page's iframe is defined as:
<iframe class="inframe" src="bucin.php" name="bucin" id="iframe_bucinid">
Notice that getting the scrollTop works with
top.frames['bucin'].document.body.scrollTop
Upvotes: 1
Views: 1347
Reputation: 2963
I had success (Chrome and Firefox) in doing what you're asking using the following code:
$('#iframe_bucinid').contents().scroll(function() {
alert('hello');
});
The key difference between your code and mine being the contents()
part.
Be sure to test this thoroughly though, you might run into problems in some browsers due to silly implementations of same origin policy.
Upvotes: 1