我想要做的是把关闭按钮从华丽的弹出式移动到灯箱外面。我试图通过应用父容器可见的溢出并将其定位到外部来做到这一点。然而,在Chrome中,会发生以下(不需要的)行为。
当关闭按钮在灯箱内被点击时,它会按预期关闭。当单击lightbox外的按钮(溢出)时,事件不会触发。
请参见以下JS:http://jsfiddle.net/JKhyM/4/
// initalize popup
jQuery(document).ready(function( $ ) {
jQuery.mp_arv_scoped.open({
items: data,
type: 'inline',
inline: {
markup: '<div class="white-popup"><div class="mfp-close"></div>'+
'<div class="mfp-content"></div>'+
'</div>',
},
closeMarkup: '<div class="mfp-set-outside"><button class="mfp-close mfp-new-close" type="button" title="Close (Esc)">X</button></div>'
,alignTop:false
,callbacks: {
markupParse: function(template, values, item) {
// optionally apply your own logic - modify "template" element based on data in "values"
// console.log('Parsing:', template, values, item);
}
}
});});
提前谢谢你们
发布于 2014-05-29 12:07:13
只需更新这个css:
不要将关闭按钮从with top:-15px;和right:-15px;中取出,请使用:
top:0px;
right:0px;
margin-top:-25px;
margin-right:-25px;使用color:white !important;可以使用您想要的颜色。
结果:
.mfp-close {
overflow: visible;
width: 30px;
height: 30px;
line-height: 30px;
position: absolute;
right: 0px;
top: 0px;
margin-top:-25px;
margin-right:-25px;
color: white !important;
font-size: 30px;
opacity: 1;
text-decoration: none;
text-align: center;
filter: alpha(opacity=100);
font-style: normal;
background:url('close.png');
font-family: Arial, Baskerville, monospace;
}演示:
https://stackoverflow.com/questions/23932701
复制相似问题