0

I have the code:

$(document).on('scroll', function() {
    if ($(this).scrollTop() == 0) {
        $('#arrow').show()('TOP!');
    }
    else {
        $('#arrow').hide()($(this).scrollTop());
    }
});

This allows me to have an image that disappears when i start scrolling and reappear when the scroll bar hits the top of the page.. But.

I was wondering if it was possible to link this JS to an iframe on my page and get the image to disappear when I scroll using the iframe?

SaturnsEye
  • 6,297
  • 10
  • 46
  • 62
  • You cannot alter anything within an iframe, it's a security feature. – Populus Sep 26 '13 at 14:54
  • I don't want to alter the content of an iframe, I just want my code to recognise when I scroll using the iframe and alter an image on MY page – SaturnsEye Sep 26 '13 at 14:55
  • You will have to change code in the iframe content, if you have access to that. Then use `window.parent` to do what you want https://developer.mozilla.org/en-US/docs/Web/API/window.parent – Populus Sep 26 '13 at 14:58
  • 1
    sorry I was wrong: http://stackoverflow.com/questions/930779/jquery-iframe-scroll-event-ie apparently it's do-able – Populus Sep 26 '13 at 15:00
  • Thank you so much for finding that it is possible but I'm unsure how to apply it as I'm no good at JS. My image ID that I want to disappear is #marker and my iframe is #productsearch. How would I apply them? – SaturnsEye Sep 26 '13 at 15:31

0 Answers0