Can I bind a function to the onscroll event of the parent window, from an <iframe>?

Can I bind a function to the onscroll event of the parent window, from an <iframe>?

I have a page that does not load jQuery. An <iframe> included on that page does load jQuery.

Using jQuery, is it possible to bind a function to an event of the window object of the parent page, even though it doesn't load jQuery?

Accessing the parent window doesn't seem to be a problem; this works (at least in Firefox 4):

  1. console.log($(parent)); // displays "jQuery(Window index.html)" in the console

To give some context, I'm developing the document to be loaded within the <iframe>, but I don't control the parent page (although it is in the same domain), so I can't use a solution that requires adding jQuery to it. Ultimately I want to subscribe to the onscroll event of the parent window to execute a function in the <iframe> every time that scrolling happens in the viewport.

I've tried (within the <iframe>):

  1. function my_function() {
  2.   console.log('Scrolling...');
  3. }
  4. $(parent).scroll(my_function);

However, that didn't work.

I'd like to avoid a pure-JavaScript solution (such as parent.onscroll = my_function) since I want to be able to take advantage of jQuery's namespaced events.

Any help would be appreciated. Thanks!