I'm using Fancybox to create a gallery on my website - Asp.Net MVC
I've added all the libraries, however, the images seem to load up in a new tab instead of working like pops with the arrows on the side.
Here is what I have in the view:
@{
ViewBag.Title = "Gallery";
}
<head>
<!-- Add jQuery library -->
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js">
</script>
<link href="../../Content/jquery.fancybox.css" rel="stylesheet"
type="text/css" />
<script src="../../Scripts/jquery.fancybox.pack.js" type="text/javascript">
</script>
<link href="../../Content/jquery.fancybox-buttons.css" rel="stylesheet"
type="text/css" />
<script src="../../Scripts/jquery.fancybox-buttons.js"
type="text/javascript"></script>
<script src="../../Scripts/jquery.fancybox-thumbs.js"
type="text/javascript"></script>
<link href="../../Content/jquery.fancybox-thumbs.css" rel="stylesheet"
type="text/css" />
<script src="../../Scripts/jquery.fancybox-media.js" type="text/javascript">
</script>
</head>
<script type="text/javascript">
$(document).ready(function () {
$(".fancybox").fancybox({
openEffect: 'none',
closeEffect: 'none',
});
});
</script>
Here is are some of the images I am trying to add:
<body>
<br />
<div class="bodyText">
<center>
<h1>Gallery</h1>
<p>Pictures taken by me in Agadir (Morocco), Dubai (UAE) and Sylhet (Bangladesh)</p>
<br /><br />
</center>
<!--inserting the images and adding descriptions-->
<center>
<a class="fancybox" rel="gallery" href="../../Content/images/agadir.jpg" title="Marina"><img src="../../Content/images/rsz_agadir.jpg" style='border:2px solid #ffffff' alt="" hspace="5" /></a>
<a class="fancybox" rel="gallery" href="../../Content/images/agadirmountain.jpg" title="Atlas Mountains trip"><img src="../../Content/images/rsz_agadirmountain.jpg" style='border:2px solid #ffffff' alt="" hspace="5" /></a>
<a class="fancybox" rel="gallery" href="../../Content/images/agadirsunset.jpg" title="Sunset in Agadir"><img src="../../Content/images/rsz_agadirsunset.jpg" style='border:2px solid #ffffff' alt="" hspace="5" /></a>
I've added a fiddle here: https://dotnetfiddle.net/MYo1WG
Check developer tools, you have JS error on your page -
Uncaught ReferenceError: $ is not defined
Fix this and it should work. The other message should give you a clue:
'http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js'. This request has been blocked; the content must be served over HTTPS.