Single Page Application And Inline Fancybox Not Working Properly
I'm trying to make a SPA and use the Hot Towel template with durandal. So far I have succesfully added a Fancybox to my spa and it shows a image Copy
Javascript:
$("a.fancybox-link").click(function (e) {
$.fancybox({
content: $('#inlineContent').html(),
type: 'inline'
});
return false;
});
Bye bye
Solution 2:
If you already initialized fancybox
$(".fancybox-thumb").fancybox({
openEffect: 'elastic',
closeEffect: 'elastic',
helper: {
title: {
type: 'outside'
},
thumbs: {
width: 50,
height: 50
}
}
});
then you can use the same script for both your images AND your inline content, so the link for the image(s) :
<a class="fancybox-thumb" rel="fancybox-thumb" href="http://farm9.staticflickr.com/8486/8225588056_d229e8fe57_b.jpg" title="Porth Nanven (MarcElliott)"><img alt="" src="http://farm9.staticflickr.com/8338/8224516167_bc7a5f6699_m.jpg" /></a>
and the link for the inline content :
<a class="fancybox-thumb" data-fancybox-type="inline" href="#inline">Inline</a>
Notice that we added the data-fancybox-type="inline"
attribute to define the type
of content for this specific item.
Your inline html structure can remain the same :
<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>
See JSFIDDLE
Post a Comment for "Single Page Application And Inline Fancybox Not Working Properly"