How To Make Iframe Listen To Scroll Events As Parent When Click Event Within Parent Iframe Is Triggered July 08, 2024 Post a Comment I have two iframes in an html page Solution 1: After the pages load the new url, you have to re-bind your scroll event handler. Listen to the iframe's onload event, and when that fires, re-bind the scroll handlers.It looks like you're using jQuery. Here's how to do it:$("#i1").load(function () { var oE1 = getFrameTargetElement( document.getElementById("i1") ); var oE2 = getFrameTargetElement( document.getElementById("i2") ); //- on source scroll oE1.onscroll = function (e) { var scrollTopValue; var scrollLeftValue; //- evaluate scroll valuesif(window.pageYOffset!=undefined) { scrollTopValue = oE1.pageYOffset; scrollLeftValue = oE1.pageXOffset; } else { scrollTopValue = oE1.scrollTop; scrollLeftValue = oE1.scrollLeft; } //- mimic scroll oE2.scrollTo( scrollLeftValue, scrollTopValue); } } Copy Share Post a Comment for "How To Make Iframe Listen To Scroll Events As Parent When Click Event Within Parent Iframe Is Triggered"