Im trying to use fancybox to show pdf´s, but Im not having sucess doing this.
I´m already using fancybox to show a div content, but now I`m trying to use fancy also to show a pdf inside.
I'm trying to open a pdf file that I have saved on my computer in the same way that I use to display content in fancybox but is not working with pdf.
I have in my html some links with href="#show"
that point to my <div id="show">
, and this links also have the class="buttonl"
, that is the class that I use in my jQuery script to open fancybox.
Like here: <a href="#show" class="buttonl" >Title of my first post</a><br />
Somebody there already use fancybox to show a pdf can give me some help?
My fiddle with code:
http://jsfiddle.net/ritz/WAKdB/1/
My jQuery:
$(document).ready(function() {
$("a.buttonl").fancybox({
maxWidth : 800,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'elastic',
closeEffect : 'elastic'
});
})
My 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>