
[英]Hidden inline div disappears after being displayed with FancyBox 2.1.5
[英]Fancybox 2.1.5 after load, loads before Lightbox appears
我目前有以下代码:
$("#img_preview_fancybox").click();
$("#img_preview_fancybox").fancybox({
title: "This is only a preview text may be adjusted to look its best.",
closeBtn : true,
openEffect : 'elastic',
closeEffect : 'elastic',
scrolling : 'no',
overlayShow: false,
afterLoad: sizeText()
});
afterLoad function 在我单击按钮后立即加载,但在框出现后立即加载,这很重要。 function sizeText() 调整文本大小以适应 window 但 Fancybox 必须加载才能正常工作。 无论如何让它在用户屏幕上出现后加载?
编辑:更新到 afterShow 但在框出现之前加载警报。
$(".fancybox").fancybox({
title: "This is only a preview text may be adjusted to look its best.",
closeBtn : true,
openEffect : 'elastic',
closeEffect : 'elastic',
scrolling : 'no',
overlayShow: false,
loop : false,
afterShow: function(current) {
alert('this shows');
var containerWidth = document.getElementById('img_preview_text_container').clientWidth;
var containerHeight = document.getElementById('img_preview_text_container').clientHeight;
console.log(containerWidth, containerHeight);
}
});
$(".fancybox").trigger('click');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.