fanybox不能正确加载内容
fancybox doesnot load the content properly
所以我在正文中添加了一个div,这个div会在点击图像a
标签时弹出。为了达到身体的叠加效果,我使用了fancybox。然而,我可以将div附加到body,但这个div不会作为一个花哨的盒子加载。有人能帮帮忙吗?
我的代码在这里:
http://jsfiddle.net/refhat/xap9F/60/进一步,我在fancybox中丢失了一些东西,我也没有看到fancybox右上角的关闭十字在chrome中,点击fancybox上的任何地方只是关闭fancybox,这不应该是这种情况。
下面是一些可以用来创建叠加的代码:
overlay = function () {
var o, c;
this.create = function (html) {
o = $('<div />');
c = $('<div />');
h = $('<div>' + html + '</div>').appendTo(c);
var o_css = {
'position': 'absolute',
'top': '0',
'left': '0',
'width': '100%',
'height': '100%',
'background': '#000', // Background of the overlay (opacity is set later)
'z-index': '10000',
'overflow': 'hidden'
};
var c_css = {
'position': 'absolute',
'top': '50%',
'left': '50%',
'width': '300px', // Width of content box
'height': '200px', // Height of the content box
'margin-left': '-150px', // Half of content width (used to center the box)
'margin-top': '-100px', // Half of content height (used to center the box)
'background': '#fff', // Background of the content
'color': '#000', // Text color
'z-index': '10001'
};
var h_css = { 'padding': '10px' }; // If you want paddning
o.css(o_css);
c.css(c_css);
h.css(h_css);
o.fadeTo(0, 0).appendTo('body').fadeTo(500, 0.5); //0.5 is opacity, change from 0.1-1.0
c.fadeTo(0, 0).appendTo('body').fadeTo(500, 1.0); //1.0 is opacity, change from 0.1-1.0
}
this.remove = function () {
o.remove();
c.remove();
}
}
你可以这样称呼它:
$(document).ready(function () {
o = new overlay();
o.create('HTML you want to fill the container with, example and image or/and text or maybe a link you later bind o.remove() to'); //This creates the overlay
o.remove(); // .. and this removes the overlay
});
相关文章:
- 如果数据为空,Ajax加载不会停止
- FileReader加载不在控制器范围Angular 2内
- requireJS 中的车把加载不成功
- 关闭-库加载不正确
- 弹出加载不起作用
- jQuery UI加载不正确?找不到对话框方法
- GULP中的Ctrl+S之后,实时重新加载不起作用
- 在解决Firebase GetRecord之前,视图加载不完整
- 网页加载不正确:'"JSON”;未定义'错误
- 加载不是来自“xampp的htdocs”或“root”文件夹的图像
- 阻止推特分享按钮加载不正确
- Durandal View偶尔加载不正确,而且总是在缩小时加载不正确
- 影子盒加载不起作用
- 传单显示悬停时的地图 - 地图加载不正确
- 余烬 CLI 实时重新加载不起作用
- 在Javascript中保存和加载不起作用
- 图像加载不能正常执行
- 偶尔懒惰加载不会;Don’我不能在有角度的情况下工作
- templateUrl资源加载不能使用webpack
- 隐藏的东西,而通过jquery加载不能正常工作