【问题标题】:Colorbox scalePhotos not working彩盒比例照片不起作用
【发布时间】:2014-08-06 10:13:03
【问题描述】:

Colorbox 的 scalePhotos 参数似乎没有按预期工作。这是我初始化颜色框的方法,在 html 末尾的 </body> 结束标记之前调用:

jQuery('a.screen').colorbox({
    rel: 'screens',
    width: '960px',
    height: '720px',
    photo: 'true',
    speed: '1000',
    scalePhotos: 'true'
});

尽管这会增加颜色框的大小,但尽管将 scalePhotos 设置为 true,图像仍会以其默认大小显示。我还尝试设置 initialWidth/Height 以及编辑 CSS,但似乎没有任何效果。

我也试过这个方法: jQuery('.screen').colorbox({
完成:函数(){ $(this).colorbox.resize({innerWidth:'800px', innerHeight:'600px', scalePhoto: true}); }
});

这是说明问题的图片: http://punchpedia.com/cbox.png

【问题讨论】:

  • 访问stackoverflow.com/questions/1060687/…以获取有关您的问题的更多信息。
  • 没有骰子;同样的问题。使用调整大小时,颜色框本身会缩放,但图像仍保持相同大小。

标签: javascript jquery html css colorbox


【解决方案1】:

我不确定它是否会正常工作。请尝试一次..

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});
                    },
                });
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多