Javascript 色盒最大尺寸

Javascript 色盒最大尺寸,javascript,jquery,colorbox,Javascript,Jquery,Colorbox,如何限制色盒的最大大小 jQuery(document).bind('cbox_open', function(){ jQuery.colorbox.maxWidth = '90%'; jQuery.colorbox.maxHeight = '90%'; }); 此代码不起作用。(((使用Scalephotos 如果为true,并且定义了maxWidth、maxHeight、innerWidth、innerHeight、width或height,则Colorbox将缩放照片以适

如何限制色盒的最大大小

jQuery(document).bind('cbox_open', function(){
    jQuery.colorbox.maxWidth = '90%';
    jQuery.colorbox.maxHeight = '90%';
});
此代码不起作用。(((

使用Scalephotos

如果为true,并且定义了maxWidth、maxHeight、innerWidth、innerHeight、width或height,则Colorbox将缩放照片以适应这些值

$("a.gallery").colorbox({rel: 'gal', scalephotos:true title: function(){
  var url = $(this).attr('href');
  return '<a href="' + url + '" target="_blank">Open In New Window</a>';
}});
$(“a.gallery”).colorbox({rel:'gal',scalephotos:true title:function(){
var url=$(this.attr('href');
返回“”;
}});
使用Scalephotos

如果为true,并且定义了maxWidth、maxHeight、innerWidth、innerHeight、width或height,则Colorbox将缩放照片以适应这些值

$("a.gallery").colorbox({rel: 'gal', scalephotos:true title: function(){
  var url = $(this).attr('href');
  return '<a href="' + url + '" target="_blank">Open In New Window</a>';
}});
$(“a.gallery”).colorbox({rel:'gal',scalephotos:true title:function(){
var url=$(this.attr('href');
返回“”;
}});

谢谢您的回答,但colorbox是从Joomla组件自动调用的。我可以在这种情况下使用此代码吗?是的,您可以使用此代码…您必须在代码中导入colorbox插件谢谢您的回答,但colorbox是从Joomla组件自动调用的。我可以在这种情况下使用此代码吗?是的,您可以使用此代码…y您必须在代码中导入colorbox插件