Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Opening multiple PDF

$
0
0

The requirement is that there are a couple of hyperlink on the left upon clicking the hyperlink I need to open PDF's on the right in a frame

(it can be a content editor or a page viewer etc.)

i placed two script editor (on the left and right, one to show hyperlinks another for the pdf).please see below for the code i have used

here i have loaded pdfs but hid all but the first one

<object class="pdfobject" id="1" data="https://keoic.sharepoint.com/sites/SiteOffices/PMMDetailsPDF/1.pdf?#zoom=85&scrollbar=1&toolbar=0&navpanes=1" width="800" height="800" type="application/pdf" /><object class="pdfobject" id="2" style="display:none;" data="https://keoic.sharepoint.com/sites/SiteOffices/PMMDetailsPDF/2.pdf?#zoom=85&scrollbar=1&toolbar=0&navpanes=1" width="800" height="800" type="application/pdf" /><object class="pdfobject" id="3" style="display:none;" data="https://keoic.sharepoint.com/sites/SiteOffices/PMMDetailsPDF/3.pdf?#zoom=85&scrollbar=1&toolbar=0&navpanes=1" width="800" height="800" type="application/pdf"  /><object class="pdfobject" id="4" style="display:none;" data="https://keoic.sharepoint.com/sites/SiteOffices/PMMDetailsPDF/4.pdf?#zoom=85&scrollbar=1&toolbar=0&navpanes=1" width="800" height="800" type="application/pdf" /><object class="pdfobject" id="5" style="display:none;" data="https://keoic.sharepoint.com/sites/SiteOffices/PMMDetailsPDF/5.pdf?#zoom=85&scrollbar=1&toolbar=0&navpanes=1" width="800" height="800" type="application/pdf" />

here i created hyperlinks pointing to the same page and Jquery to show the pdfs. 

<a href=" #" class="pdflink" objectid="1">Pdf1</a> <br><a href=" #" class="pdflink" objectid="2">Pdf1</a><br><a href=" #" class="pdflink" objectid="3">Pdf1</a><br><script src="https://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script><script type="text/javascript">
$('.pdflink').click(function(){
    $('.pdfobject').hide(); //Hide all pdf
    var objId = $('this').attr('objectid'); //Get pdf object element id from link
    $('#' + objId).show(); //Show respective pdf
});</script>

For some reason the above is not working. Any help is greatly appreciated.



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>