Visible window height instead of $(window).height();

前端 未结 3 1315
梦谈多话
梦谈多话 2021-02-03 17:34

Is there any way to get the visible height of the whole page from inside an iframe, $(window).height() gives me the iframes height?

3条回答
  •  借酒劲吻你
    2021-02-03 18:28

    If you are using frames, you can get the height of the outermost window by using window.top in the jQuery constructor. The height of window.top will get the height of the browser window.

    $(window.top).height();
    

    Edit: Updated window.top reference as Mozilla moved their documentation around.

提交回复
热议问题