2017-06-16 104 views
2

我使用jQuery Media Plugin在浏览器中查看PDF文件。我有一个弹出窗口,它使用jQuery Media Plugin加载PDF。然而,媒体插件似乎只允许定义这样一个固定的宽度和高度:jQuery Media插件全高和宽度

$('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}); 

这似乎工作,但我不知道这是否是做的正确的方式,如果将跨浏览器工作。

回答

1

文件heightwidth文件准备后得到

$(document).ready(function(){ 
    xheight = $(document).height(); 
    ywidth = $(document).width(); 
    $('a.media').media({width:ywidth, height:xheight}); 
}); 

我希望这会为你工作