Reputation: 41
I've got a simple 'a' tag in my html like so
<a class='gallery' href='image.jpg'>photo</a>
My jquery is this...
$(document).ready(function() {
$('a.gallery').colorbox();
});
However, it just opens the image in a new window.
My imports are like so...
<link rel="stylesheet" href="colorbox.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="jquery.colorbox-min.js"></script>
As far as the download is concerned, I extracted it into the folder with the rest of my website files.
Upvotes: 2
Views: 774
Reputation: 6538
I think your js ressources are not found. Try to use a CDN and check your js paths.
I put a working example here.
$(document).ready(function() {
$('a.gallery').colorbox();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.4/jquery.colorbox-min.js"></script>
<a class='gallery' href='http://www.telegraph.co.uk/content/dam/Travel/galleries/travel/hubs/thebigpicture/the-big-picture-photography-competition-round-393/Fary-Afshar-xlarge.jpg'>photo</a>
Upvotes: 2