1

I have added fancybox to my site but every way I try it just won't work. All it does is just open the image in a new window! I am only calling jQuery once. The only thing I can think is it's conflicting with the other JavaScript code in my site.

When I run the page using Firebug I get the error: "type error fancybox is not a function". All code is in end of head tag.

Here is code:

<link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />

<script src="js/libs/modernizr.min.js"></script>
<script src="js/libs/jquery.easing.1.3.min.js"></script>
<script src="js/libs/jquery.fitvids.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript" src="/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(".fancybox").fancybox();
});

<a class="fancybox" rel="group" href="images/linked _big.png"><img src="images/linked.png" alt="linked" /></a>
halfer
  • 18,701
  • 13
  • 79
  • 158
  • 1
    Can you give us the link to the page? – Phil Dec 02 '13 at 23:12
  • you didn't forget to load jQuery, did you? I don't see it in your code above unless is embedded in another js file. Also check your fancybox paths. This `/fancybox/source/...` means that fancybox folder is located at the root – JFK Dec 03 '13 at 01:01
  • sorry i did load the jquery before the javascript files i just forgot to put it in: ; and yes my fancybox folder is located in the root. I dont have a web host to upload the page at the moment is there another way i can do it? – user3059109 Dec 03 '13 at 16:47
  • this `fancybox is not a function` error is typical when fancybox js file is not loaded so I insist : "check your paths" otherwise we don't have ways to help you – JFK Dec 03 '13 at 22:17
  • i solved it, it was to do with the paths..that little slash at the beginning. feel stupid now. thanks for your help though much appreciated! – user3059109 Dec 04 '13 at 09:26

0 Answers0