我在仅使用可用视口设置颜色框时遇到问题。一旦我设置了 maxHeight 或 maxWidth 属性,就不会显示任何图像。颜色框打开,但停留在“纺车”上。
function showImage(e) {
$.colorbox({href:$(e.currentTarget).attr("src")}); }
jQuery(document).ready(function () {
$('.popout').on("click", showImage);
$('.popout').colorbox({rel:'popout', maxWidth:'95%', maxHeight:'95%'}); });
<img class="popout" src="my.jpg" alt="" width="500" height="373" />
那么,我的代码有什么问题?或者我是否还需要设置其他属性才能使 maxWidth/height 正常工作?