How do I use colorbox to show hidden divs on my page without hardcoding?

后端 未结 4 2021
走了就别回头了
走了就别回头了 2021-02-13 03:31

I\'m using Colorbox to show the html content of hidden divs on my page. I can get this to work perfectly with the following:

$(\"a.colorbox\").colorbox({width:\         


        
4条回答
  •  独厮守ぢ
    2021-02-13 04:09

    This is the way I got it to work

    HTML: (taken from the example in one of the answers)

    Lightbox trigger
    

    Lightbox content goes here

    Javascript:

    $('a.lightboxTrigger').click(function(){ 
        var ref = $(this).attr("href");
        $.colorbox({ html: $(ref).html() });
        $.colorbox.resize();
     });
    

提交回复
热议问题