Colorbox的scalePhotos参数似乎没有按预期工作。下面是我初始化colorbox的方法,它是在html末尾的结束</body>标记之前调用的:
jQuery('a.screen').colorbox({
rel: 'screens',
width: '960px',
height: '720px',
photo: 'true',
speed: '1000',
scalePhotos: 'true'
});尽管这会增加colorbox的大小,但尽管将scalePhotos设置为true,图像仍以其默认大小显示。我还尝试了设置initialWidth/Height以及编辑CSS,但似乎都不起作用。
我也尝试过这个方法: jQuery('.screen').colorbox({
函数: onComplete (){ $(this).colorbox.resize({innerWidth:'800px',innerHeight:'600px',scalePhoto: true});}
});
这里有一张图片说明了这个问题:http://punchpedia.com/cbox.png
发布于 2014-08-07 11:55:42
我不确定它是否会工作correctly.just尝试一次..
jQuery(document).ready(function(){
jQuery("a.media-gallery-thumb").colorbox({
onComplete:function() {
var x = jQuery('div.lightbox-stack div.media-gallery-item div.gallery-thumb-outer div.gallery-thumb-inner a img').width();
var y = jQuery('div.lightbox-stack div.media-gallery-item div.gallery-thumb-outer div.gallery-thumb-inner a img').height();
jQuery(this).colorbox.resize({width:x, height:y});
},
});
});https://stackoverflow.com/questions/25157711
复制相似问题