我试图用fancybox来显示pdf的,但我没有成功做到这一点。试图显示pdf内fancybox
我已经使用fancybox来显示div的内容,但现在我正尝试使用幻想也显示一个PDF里面。
我试图打开一个pdf文件,我保存在我的电脑上,就像我用fancybox显示内容的方式一样,但不能用pdf工作。
我在我的HTML与href="#show"
指向我<div id="show">
一些链接,而这个链接也有class="buttonl"
,那就是我在jQuery脚本用来打开的fancybox类。
喜欢这里:<a href="#show" class="buttonl" >Title of my first post</a><br />
有人有已经使用的fancybox来显示PDF格式可以给我一些帮助吗?
我与代码小提琴:
http://jsfiddle.net/ritz/WAKdB/1/
我的jQuery:
$(document).ready(function() {
$("a.buttonl").fancybox({
maxWidth : 800,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'elastic',
closeEffect : 'elastic'
});
})
我的HTML:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<article id="loop-news">
<h2>
<a href="#show" class="buttonl" >Title of my first post</a><br />
</h2>
<span>Tuesday<strong>,</strong> 8 April 2014</span>
<p>My first post content is this!</p>
<a class="buttonl" href="#show"> Read more</a>
<div id="show">
<h2>IM the fancybox content!!</h2>
</div>
</article>
<hr>
<article id="loop-news">
<h2>
<a href="#show" class="x">Post with pdf</a><br />
</h2>
<span>Tuesday<strong>,</strong> 8 April 2014</span>
<p>My first post with pdf!</p>
<a class="buttonl" href="#show"> Read more</a>
<div id="show">
<a href="../design_multimedia_method.pdf"></a>
</div>
</article>
你必须o把它作为iframe,从http://fancyapps.com/fancybox/#examples No.15 – JFK
检查http://jsfiddle.net/RHaAX/那么,被引用的文档被移动了,但试试这个http:// jsfiddle.net/SQSFp/ – JFK
谢谢你的回答,但是我不能在我的本地机器上安装pdf吗?我需要在服务器上托管我的pdf吗? – OzzC