I'm encountering an issue retrieving 2 different file types, .jpg and .pdf, filed in the same SharePoint folder.

What I'm trying to achieve is retrieve the .jpg thumbnail of the publication cover and place them horizontally on the site page; each .jpg is wrapped with an anchor tag linked to a .pdf file of the publication. This .pdf publication with appear in a fancybox popup when the thumbnail is selected.

I'm able to make this happen, with only the .jpg files only in the folder, using the .jpg file for both the thumbnail and linked file that popup in fancybox. But I need the .pdf to be the link file.

Everything I have tried to retrieve the two different file types and place them as mentioned fail. Below is my current script which doesn't display the thumbnail (show a broken link to the .jpg). But when I select the broken image link icon, the pdf publication with launch in fancybox. Any ideas anyone can offer to get me on a good path would be appreciated.

jQuery(document).ready(function() {
        ExecuteOrDelayUntilScriptLoaded(getLoggedInUser, "sp.js");
        
getFilesFromFolder("/sites/Creative/Shared%20Documents/Recognition/Quarterly").done(function(data) {
        $.each(data.d.results,function(i,item) {
        
    
    $("#container").append('<div class="alignImage blogBox moreBox"><a data-fancybox data-type="iframe" href="https://publication/issues/Pub-"' + i + '".pdf"' + '"href= "javascript:;"> <img src="https://publication/issues/Pub_thumb-"' + i + '".jpg"' + '" id="image"'  + i + '"></a><div class="pub blogBox moreBox"><span id="issue"' + i + '"> DCSA Gatekeeper, ISSUE "'  +  i + '"</span><br>Select icon to read issue.</a></div></div>');
            
        });
    });
0

There are 0 answers