dongyo1959
2013-05-07 17:36Fancybox未打开PDF错误未捕获ReferenceError:未定义href
i found some really interesting code on this web on how to open a PDF inside Fancybox iframe, but I want to use inside a CSS Menu that I generated through PHP, and get this message through Google Console: Uncaught ReferenceError: href is not defined
Here's my php code:
echo "<li class ='pdf' ><a href='http://assets/newsletters/temp/".$myissue."' > Issue# ".$filename."</a></li> ";
And in the Fancybox i have the following code:
<script type="application/javascript">
$(document).ready(function() {
$(".pdf").click(function() {
$.fancybox({
type : 'iframe',
width: 800,
height: 1000,
fitToView : true,
autoSize : false,
href: this.href,
content : '<embed src="' + href + '#nameddest=self&page=1&view=FitH,0&zoom=75,0,0" type="application/pdf" height="99%" width="100%" />',
'onClosed': function() {
$("#fancybox-inner").empty();
}
});
return false;
}); // pdf
}); // ready
</script>
I need help so I can load a different PDF everythime I make a click.
UPDATE So I changed the content with the file I want to see, and it works. So my problem still being the dynamic Href that I dont know how to pass it to fancybox
content : '<embed src="http://assets/newsletters/temp/Newsletter_1.pdf" type="application/pdf" height="99%" width="100%" />',
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- Fancybox未打开PDF错误未捕获ReferenceError:未定义href
- php
- jquery
- 2个回答