2012-11-08 50 views
5

hi i am đang cố gắng hiển thị một PDF với fancybox nhưng tôi không thể.fancybox hiển thị pdf

tôi có mã này:

$(".fancybox").fancybox({ 
     'frameWidth': 100, 
     'frameHeight':495, 
     'overlayShow':true, 
     'hideOnContentClick':false, 
     'type':'iframe' 
}) 

<a class="fancybox" href="/symfony2/web/app.php/pdf/2"> show pdf</a> 

nhưng chỉ cho tôi cách tạo pdf:

http://www.subirimagenes.com/imagen-pantallazo-8110661.html

Có ai biết làm thế nào để giải quyết vấn đề để hiển thị chính xác facybox? Một lời chào.

Trả lời

7

Bạn có thể giải thích những gì exatly không phù hợp với bạn? Nó sẽ hoạt động - http://jsfiddle.net/zqJFp/

<a class="fancybox" href="http://samplepdf.com/sample.pdf">Open pdf</a> 

​$(".fancybox").fancybox({ 
    width : 600, 
    height : 300, 
    type :'iframe' 
});​ 
3

công việc này cho tôi tôi hy vọng có hiệu quả với bạn!

<a class="btn btn-info btn-sm btn-hover gallerypdf" data-fancybox-type="iframe" href="../../assets/img/exp_2493_parte-3.pdf"><span class="glyphicon glyphicon-eye-open"></span></a> 

<script> $(document).ready(function() { 
$(".gallerypdf").fancybox({ 
openEffect: 'elastic', 
closeEffect: 'elastic', 
autoSize: true, 
type: 'iframe', 
iframe: { 
preload: false // fixes issue with iframe and IE 
} 
}); 
}); 
</script> 
+1

'iframe: { preload: false // fixes issue with iframe and IE }' this fixed issue for IE 9 –

Các vấn đề liên quan