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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -