Search code examples
colorbox

colorbox window size justify


I am trying to call colorbox with the following js:

$.colorbox({html: '<img src="example.com/some.jpg">some more html tags..',});

img is dynamically generated. the problem is that colorbox opens but with very tiny window. How to make colorbox justify the window automatically?


Solution

  • Do you know what size the image will be? If so, you could solve it by putting the dimensions on the <img> element:

    <img src='example.jpg' width='500' height='500'/>