jquery - Trying to show pdf inside fancybox -
im trying use fancybox show pdf´s, im not having sucess doing this.
i´m using fancybox show div content, i`m trying use fancy show pdf inside.
i'm trying open pdf file have saved on computer in same way use display content in fancybox not working pdf.
i have in html links href="#show"
point <div id="show">
, , links have class="buttonl"
, class use in jquery script open fancybox.
like here: <a href="#show" class="buttonl" >title of first post</a><br />
somebody there use fancybox show pdf can give me help?
my fiddle 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 first post</a><br /> </h2> <span>tuesday<strong>,</strong> 8 april 2014</span> <p>my first post content this!</p> <a class="buttonl" href="#show"> read more</a> <div id="show"> <h2>im fancybox content!!</h2> </div> </article> <hr> <article id="loop-news"> <h2> <a href="#show" class="x">post pdf</a><br /> </h2> <span>tuesday<strong>,</strong> 8 april 2014</span> <p>my first post pdf!</p> <a class="buttonl" href="#show"> read more</a> <div id="show"> <a href="../design_multimedia_method.pdf"></a> </div> </article>
is possible have 1 fancybox script allow show pdf , div content?
yes, may need configure html :
<a class="buttonl" data-fancybox-type="iframe" href="document.pdf">open pdf</a> <a class="buttonl" href="#inline">open inline content</a> <div id="inline" style="display:none"> <p>lorem ipsum</p> </div>
notice have set data-fancybox-type
attribute link opens pdf document fancybox know how deal it
then can use single script both types of content
jquery(document).ready(function ($) { $("a.buttonl").fancybox({ maxwidth: 800, fittoview: false, width: '70%', height: '70%', autosize: false, closeclick: false, openeffect: 'elastic', closeeffect: 'elastic', afterload: function () { if (this.type == "iframe") { $.extend(this, { iframe: { preload: false } }); } } }); });
notice option iframe preload
apply if type
of content
iframe (set data-fancybox-type
in our link)
Comments
Post a Comment