I have tried to use fancybox to display a gallery of images. I have also tried bootstrap 3 Lightbox (http://www.jasonbutz.info/bootstrap-lightbox/) but i cant get that to work either.
I have tried tons of different formats, however none of them are working.
Header:
<link rel="stylesheet" type="text/css" href="/css/libs/gallery/jquery.fancybox.css">
Scripts:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/js/libs/jquery.fancybox.pack.js"></script>
Included at bottom of the page where i display the images:
<script>
$(function() {
$('a.grouped_elements').fancybox({
type: 'image',
padding: 0,
scrolling: 'no',
helpers : {
overlay: {
css: {'background-color': '#000'},
opacity: 0.3
},
title : { type : 'inside' }
}
});
});
</script>
I have tried without the function call, and within a document.ready call, but this doesn't make any difference. I have tried the simple format $('a.grouped_elements').fancybox();
and also just calling the class without calling a
first.
Where I display the images:
@foreach ($user->photos()->get() as $photo)
<a class="grouped_elements" rel="group1" href="{{ $photo->path }}" >
<img class="galleri" style="width:200px;height:200px;margin-bottom:10px;
margin-right:5px;" src="{{ $photo->path }}" alt="" title="" />
</a>
@endforeach
All images display. The scripts and css are called correctly as these show if i go to the source and press them.
Whenever i click on an image, it shows the image in large format, but not in a "fancybox".
If i call alert('Hello');
i do get an alert box.
I have other stuff included on the page, such as google maps etc. and all of this works fine.
I have tested if jQuery is working using this example, and the example works fine.
What am i doing wrong, and how can i fix this problem?