javascript - Launch fancyBox from button click -
im stuck little problem fancybox v2.
i want launch fancybox on button click. once clicked, load images list (from src attribute of ).
i have created jsfiddle show trying do: http://jsfiddle.net/fpfzg/
jquery(document).ready(function($) { $('button').on('click', function() { $.fancybox(); }); });
can see how possible?
i had same question , found following simpler method:
html
<button class="fancybox" value="open fancybox">open fancybox</button> <div class="hidden" id="fancybox-popup-form"> (your fancybox content goes in here) </div>
jquery
$('.fancybox').click(function () { $.fancybox([ { href : '#fancybox-popup-form' } ]); });
css
.hidden { display: none; }
further reading
fancybox docs (click "api methods" tab, read on first method, called "open").
Comments
Post a Comment