Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Fancybox PDF through dynamic href

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #44616
    CoderNinja
    Member

    Hi guys, im having a problem trying to open some PDF from php code:

    echo “

  • Issue# “.$filename.”
  • “;

    I dont know how to send my dynamic href to the fancybox? So I can open it with fresh data everytime i make a click on the link above. Here the fancybox:

    $(document).ready(function() {
    $(“.pdf”).click(function() {
    $.fancybox({
    type : ‘iframe’,
    width: 800,
    height: 1000,
    fitToView : true,
    autoSize : false,
    href : this.ref,
    content : ‘‘,
    beforeClose : function() {
    $(“.fancybox-inner”).unwrap();
    }
    });
    return false;
    }); // pdf
    }); // ready

    Does anybody has an idea? thanks

#134471
CoderNinja
Member

I wasn’t trying to embed a PDF, I got that part wrong, so finally I fixed this code, now i’m able to display my dynamic PDF inside the fancybox. Here’s the code:

$(document).ready(function () {
$(“.pdf”).fancybox({
type: ‘iframe’,
width: 800,
height: 1000,
fitToView: false,
autoSize: false,
iframe : {
preload: false
}
});
}); // ready

And my PHP code was corrected as well:

echo “

  • Issue# “.$filename.”
  • “;

    I found a little issue trying to open this on IE & Chrome, so this line of code saved my life:
    iframe : {
    preload: false
    }
    I leave it here so anybody can use it, cheers!

    Viewing 2 posts - 1 through 2 (of 2 total)
    • The forum ‘Other’ is closed to new topics and replies.