How can I get a colorbox to display in a div?

At the moment I set Colorbox , so that it runs automatically when the page loads, but I need to place it in a div on the page, instead of hovering in the center of the page. How can i do this? Thanks for reading.

+3
source share
2 answers

You can insert this javascript snippet into your javascript at the end of the document where you are binding the colorbox.

$(document).bind('cbox_complete', function(){
        var divContent = $('#cboxLoadedContent').html(); // Grab the content of cboxLoadedContent div
        $('#colorbox').hide(); // Hide colorbox div
        $('#cboxOverlay').hide(); // Hide the overlay div
        $('#Output').html(divContent); // put the content inside the specified div.
});

This means that after the image / page has been successfully uploaded to the colorbox, it will immediately grab this content, hide the colorbox and overlay and upload this content to a new div.

, , colorbox , . , : onOpen onLoad. . , colorbox .

cboxLoadedContent, #cboxWrapper #colorbox divs, , div.

, , , div.

Colorbox Site .

+3

, Colorbox - , . , , . : Galleriffic Galleria

+2

Source: https://habr.com/ru/post/1760718/


All Articles