fancybox
fancybox copied to clipboard
Using FB V3 & opening an iFrame programmatically. But, the hash is missing!
Hello...
When I open a iframe URL thru litebox programmatically ( with the basic code below), hash does not change.
I'd like the hast to be part of the URL, just like the normal hrefs with data attributes automatically do.
The reason I like this is because when you load a page with that URL ( with the hash ),as soon as the browser loads the main URL, your code kicks in and fires up the litebox of that iframed URL
But when I open my lightbox thru this code, this functionality is missing in action.
$.fancybox.open({
type: 'iframe',
src:url,
opts : {
afterClose : function( instance, current ) {
$('.closerX').css('visibility', 'visible');
},
afterLoad : function( instance, current ) {
$("body").css("cursor", "default");
}
}
});
Is there a way to add the hash programmatically into the above code so I can enjoy the same functionality?
Thank you
Hi,
This feature is available in v4, but I honestly do not remember about v3. I think it was not fully implemented. You can try to pass hash
option, like opts : { hash : "aaa" }
. I think that for full functionality you would have to check URL hash on start to see if Fancybox should start, and you would also have to watch URL hash change to see if you have to open/close Fancybox.
I think a custom solution can be developed, each hash acts as a key to map to a specific URL, and when Dom loads and onReady we can check the window.location.hash, and if there is a hash to be acted upon, we simply act upon by firing the same iframe FB programmatic call that popped that lightbox in the first place.