I'm trying to make a SPA and use the Hot Towel template with Durandal. So far I have successfully added a Fancybox to my spa and it shows a image
<a class="fancybox-thumb" rel="fancybox-thumb" href="http://farm9.staticflickr.com/8486/8225588056_d229e8fe57_b.jpg" title="Porth Nanven (MarcElliott)">
<img src="IMAGEPATH" alt="" />
</a>
$(document).ready(function () {
$(".fancybox-thumb").fancybox({
openEffect: 'elastic',
closeEffect: 'elastic',
helper: {
title: {
type: 'outside'
},
thumbs: {
width: 50,
height: 50
}
}
});
$('#label').click(function () {
$('#inline').fancybox();
});
});
This is working not that properly but okay;)
Now I want to have a own inline in the fancybox like this:
<div id="inline" style="display:none;width:500px;">
<p>
<a id="add_paragraph" title="Add" class="button button-blue" href="javascript:;">Add new paragraph</a>
<a href="javascript:$.fancybox.close();">Close</a>
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
Now when I click: <a class="fancybox-thumb" href="#inline">Inline</a>
, I do get the fancybox with my info. But the url is set back to localhost:2321/#inline so I'm redirected back to home but I do see the fancybox.
How can I solve this, so that the fancybox is shown an the right page in my SPA and stays there?
I have got this working ;)
THis is what I did,
HTML:
<a class="fancybox-link">Inline</a>
<div style="display: none">
<div id="inlineContent" style="width:1000px;">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
<a id="add_paragraph" title="Add" class="button button-blue" href="javascript:;">Add new paragraph</a>
<a href="javascript:$.fancybox.close();">Close</a>
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</div>
</div>
Javascript:
$("a.fancybox-link").click(function (e) {
$.fancybox({
content: $('#inlineContent').html(),
type: 'inline'
});
return false;
});
Bye bye