我想将 2 或 3 个颜色框堆叠在一起,但不像俄罗斯娃娃那样在彼此的边界内,更像是第一个覆盖 50% 的屏幕,第二个覆盖 100% 的屏幕,并且然后第三个再次覆盖屏幕的 50%。
在 here 的帮助下,我成功地创建了效果,但问题是当我关闭颜色框时,所有当前打开的颜色框都会同时关闭。我想要关闭按钮只是为了关闭该颜色框。理论上人们会按顺序关闭它们,但我显然无法预测这一点。
我认为这与 jquery 选择器关闭所有打开的颜色框有关。任何指示表示赞赏。
创建第一个颜色框的代码:
$.colorbox({iframe:true, width:width, height:height, scrolling: false, href:linkRef, fastIframe:false, onClosed:function(){$('#cboxClose').attr('class', '');}});
$('#cboxClose').attr('class', 'photomontageFrame');
创建第二个颜色框的代码:
window.parent.$.colorbox({iframe:true, width:width, height:height, scrolling: false, href:a, onClosed:function(){$('#cboxClose').attr('class', '');}});
window.parent.$('#cboxClose').attr('class', 'photomontageFrame');
谢谢
最佳答案
我认为您的问题不是 iframe,而是 colorbox 仅支持一个实例。它看起来也是一个非常老的插件,不支持最新版本的 jQuery。我会寻找不同的插件。
关于javascript - iframe 中的多个颜色框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25204097/