我使用jQuery媒体插件在浏览器中查看PDF文件。我有一个弹出窗口,其中加载的PDF使用jQuery媒体插件。然而,媒体插件似乎只允许像这样定义一个固定的宽度和高度:
$('a.media').media({width:500, height:400});我想设置它,使其100%宽和高。我在网上找不到任何答案。我目前已经使用$(document).height()和$(document).width()来获取值并进行如下设置:
xheight = $(document).height();
ywidth = $(document).width();
$('a.media').media({width:ywidth, height:xheight});这看起来确实有效,但我不确定这是不是正确的方法,也不确定它是否可以跨浏览器工作。
发布于 2017-06-16 19:36:07
Document height和width在文档就绪后获取
$(document).ready(function(){
xheight = $(document).height();
ywidth = $(document).width();
$('a.media').media({width:ywidth, height:xheight});
});我希望这对你有用。
https://stackoverflow.com/questions/44587025
复制相似问题