jQuery\'s scrollTop returns null when window is an iframe. Has anyone been able to figure out how to get scrollTop of an iframe?
more info:
my script is runn
I have faced the same problem in my iframe. My whole website comming white iframe and scrolling not working So I used this code and it's work fine.
Step 1. put this code to your iframe
var offsettop = 120;
window.parent.postMessage({"setAnchor": offsettop}, "*");
Step 2. put this code where your call you iframe
window.addEventListener('message', function(event) {
if(event.data['setAnchor']>0) {
var offsetHeight =event.data['setAnchor'];
jQuery('html, body').animate({
scrollTop: offsetHeight
}, 200);
}
})