Skip to content

Fancybox not working in sidebar #58

@juliettefabre

Description

@juliettefabre

Hi,

I'm trying to use the Fancybox library in the sidebar of a map made with leaflet 1.3.1.
When I click on a marker, I get from the database a list of photos associated to the marker. Then I open the sidebar to display them inside the sidebar with Fancybox, but photos don't "open" with fancybox (then open in a new tab of the browser).
The code works fine if it's not contained in the leaflet sidebar.

<a class="fancybox thumbnail" rel="gallery" href=myphoto.jpg" title="myphoto">
<img class="img-responsive" src="myphoto.jpg"/>
</a>
<script>
$(function() {				
	$(".fancybox").fancybox({			
		'titlePosition'  : 'inside'		 
	});
});
</script>

I found a similar question about using fancybok in a leaflet popup, but it does not change anything when I specify in my leaflet map javascript:

$(function() {		
	my_map.control.sidebar.on('shown', function () {
		$(".fancybox").fancybox({			
			'titlePosition'  : 'inside'		 
		});
	});
});

Any idea?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions