With fancybox (v2), how can I create a unique url that, upon load, displays the fancybox with iframe content. I have it working great with inline content (ex. www.mysite.com/index.html#idgoeshere), but don't know what the url or js should contain in order to load the fancybox, and within it, a specific iframe or ajax.txt page.
What I am trying to achieve, is by going to a link like:
www.mysite.com/index.html#iframe.html
Load the index page, with the fancybox window opened, and the iframe.html page loaded into the fancybox window (alternatively it can be a .txt file loaded via ajax too).
HTML
<a class="fancybox fancybox.iframe" href="iframe.html">Iframe</a>
Fancybox
<script>
$(document).ready(function($) {
$.fancybox({
content: $(window.location.hash).html()
});
$('.fancybox').fancybox();
});
</script>
Thanks for any help or guidance.
Kyle
Update
Thanks for everyones help!! Here is what ended up working great for me. I saved our my content into separate html files and then called them with fancybox.iframe
JS:
<script>
$(document).ready(function () {
$('.fancybox').fancybox({
'scrolling' : 'no'
});
if (window.location.hash !== "") {
$(window.location.hash).click();
}
});
</script>