Very simple test.html page:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox.pack.js"></script>
<link rel="stylesheet" href="fancybox/jquery.fancybox.css" type="text/css" media="screen"/>
<script type="text/javascript">
$(document).ready(function () {
/* This is basic - uses default settings */
$("a.iframe").fancybox();
});
</script>
</head>
<body>
<a class="iframe" href="http://www.google.be/">This goes to iframe</a>
</body>
</html>
Yet, fancybox just won't work... The references to the js file and css are correct. JQuery functions normally. But clicking the link acts just a normal link. Ie: I get redirect to google.be. FYI: It's not just with google, it's with every single URL I put there. What am I missing here?
$(function() { $(". fancyboxIframe"). fancybox({ maxWidth : 900, maxHeight : 600, fitToView : false, width : '90%', height : '90%', autoSize : false, closeClick : false, openEffect : 'none', closeEffect : 'none', iframe: { scrolling : 'auto', preload : true } }); });
I had success changing the class on the anchor to fancybox fancybox.iframe
.
<a class="fancybox fancybox.iframe" href="http://www.google.be/">This goes to iframe</a>
<script type="text/javascript">
$(document).ready(function() {
$('a.fancybox').fancybox();
});
</script>
No idea why this is the case but it worked for me.
Edit: also need to update to a recent version of jQuery
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With