I have the same issue encountered by many others, but it seems there was no definitive answer, so I'm sorry if this counts as a double post.
My site http://brava-studio.com works with fancybox galleries. Originally, a user could only click a button to open a gallery. I also want to have specific urls that directs the user to a specific gallery. I made a temporary solution in which http://brava-studio.com/#EarthHouse directs to the 'Earth House' project gallery for example. Sadly, because of my bad code, everything that follows the #
will direct to the same gallery.
my code below:
var thisHash = window.location.hash;
$(document).ready(function () {
if (window.location.hash) {
$("#fancybox-earth-g").trigger('click');
}
});
combined from Fancybox blog => 6). Start FancyBox on page load :
jQuery(document).ready(function() {
$("#your_selector").trigger('click');
});
and from How to create a direct link to any fancybox box
var thisHash = window.location.hash;
$(document).ready(function () {
if (window.location.hash) {
$(thisHash).fancybox({
padding: 0
// more API options
}).trigger('click');
}
$('.fancylink').fancybox({
padding: 0
// more API options
});
}); // ready