【发布时间】:2014-08-19 15:24:25
【问题描述】:
我想做一个滚动 ajax 加载更多记录的功能,但是......
我在外部网站的 iframe 中。父站点自动将 iframe 的高度设置为其内容(我的内容)的高度。如何检测用户是否向下滚动父站点直到 iframe 竞争结束?
我在网络上尝试了几种解决方案,但它们都不能在 iframe 中工作。
这里有一个小提琴示例:http://jsfiddle.net/57oyyoc7/1/
$(window).scroll(function() {
if($(window).scrollTop() == $(document).height() - $(window).height()) {
// ajax call get data from server and append to the div
console.log("load more");
}
});
【问题讨论】:
-
你不能。在这种情况下,它必须是来自父级的 javascript 才能检测到这一点。
标签: javascript jquery iframe