我有一个我已应用的按钮
$('.l_men_but').click(function(){
window.parentIFrame.scrollTo(0,0);
return false;
});

单击该按钮时,页面视图会完全更改,因此我希望将用户滚动到页面顶部。
这个scrollto函数似乎运行良好,虽然返回false;似乎需要这才能生效。
我看到的问题是在某些浏览器上,包括Chrome,IE和移动浏览器,当点击按钮时,父视图滚动到顶部但iframes height元素更改为0px?
调整屏幕大小后,iframe会再次调整大小。
按下按钮后查看控制台日志,我看到以下内容: -
iFrameSizer][iFrameSizer0] Trigger event: Mouse Down
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: Mouse Up
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLInputElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: parentIFrame.size()
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event lock on
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Sending message to host page (iFrameSizer0:2902:720:size)
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Sending message to host page (iFrameSizer0:0:0:scrollTo)
resizer.js:1 [iFrameSizer] iFrameSizer0 height set to 2902px
resizer.js:1 [iFrameSizer] iFrameSizer0 height set to 0px
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLDivElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event cancelled: resize
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event lock off
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] --
调整大小后
[iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLDivElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event lock on
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Sending message to host page (iFrameSizer0:2903:721:mutationObserver)
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event cancelled: resize
resizer.js:1 [iFrameSizer] iFrameSizer0 height set to 2903px
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLDivElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event cancelled: resize
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLDivElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Sending message to host page (iFrameSizer0:2906:723:mutationObserver)
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event cancelled: resize
resizer.js:1 [iFrameSizer] iFrameSizer0 height set to 2906px
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event: mutationObserver: [object HTMLDivElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event cancelled: resize
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] Trigger event lock off
iframeResizer.contentWindow.js:140 [iFrameSizer][iFrameSizer0] --
我非常感谢任何建议,我认为我已经正确阅读了davidjbradshaws实施指南,但我无法理解为什么这一部分应该工作
提前谢谢。
根据@ david-bradshaw
的要求添加了新日志iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Sending message to host page (res-iframe:3703:850:mutationObserver)
resizer.js:1 [iFrameSizer] res-iframe height set to 3703px
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event cancelled: resize
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event lock off
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] --
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event: Touch Start
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event: Touch End
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] No change in size detected
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event: Mouse Down
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event: Mouse Up
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event: mutationObserver: [object HTMLInputElement] attributes
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event lock on
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Sending message to host page (res-iframe:2345:850:mutationObserver)
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Sending message to host page (res-iframe:0:0:scrollTo)
resizer.js:1 [iFrameSizer] res-iframe height set to 2345px
resizer.js:1 [iFrameSizer] res-iframe height set to 0px
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event cancelled: resize
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] Trigger event lock off
iframeResizer.contentWindow.js:140 [iFrameSizer][res-iframe] --
答案 0 :(得分:0)
他们在该日志中没有显示iFrameResizer将高度更改为零。所以你必须有其他的东西在它上面。