I have a small javascript/jquery script on page1 (an aspx page) that scrolls an iframe loaded with page2 so that it stays with you on the page as you scroll up and down page1. However, when I load page1 inside an iframe for another parent page the scroll affect doesn't work.
I've tried using window.parent in the calls, but the script still doesn't activate and scroll the page2 iframe as you scroll page1 within the iframe of the parent page (another aspx page). I hope that makes sense.
Here is the script I've tried:
<script type="text/javascript">
$(window.parent.document).ready(function () {
var $scrollingDiv = $("#IframeDir");
$(window.parent).scroll(function () {
$scrollingDiv
.stop()
.animate({ "marginTop": ($(window.parent).scrollTop() + -10) + "px" }, "slow");
});
});
</script>
It works if I just load page1 in it's own tab or window, but if I load page1 within an iframe into the parent page, it doesn't seem to see the scroll event of the parent page.
Thanks in advance for any suggestions! Erin