通过绑定html对象、需要的内容、样式、绑定需要的事件可以方便的实现弹出窗口显示内容。
BaseWindow()Contents
myTag
窗口对象
myHtml
窗口html
myStyle
窗口样式
myIsDisplayScroll
禁止滚动
myWindow
当前窗口对象
myCloseCallback
窗口关闭执行方法
show()
显示
示例:
var html = "";
html += "<div class=\"preview_img_content\">";
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
html += "<div class=\"preview_img_content\">";
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
展示效果:
clsoeParentBackground(callback)
关闭主背景
参数:
- callback:关闭主背景后执行方法
示例:
html += "<div class=\"preview_img_content\">";
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
setTimeout(bw.clsoeParentBackground,3000);//三秒后关闭主背景
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
setTimeout(bw.clsoeParentBackground,3000);//三秒后关闭主背景
展示效果:
close(callback)
关闭
参数:
- callback:关闭后执行的操作
示例:
html += "<div class=\"preview_img_content\">";
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
setTimeout(bw.close, 3000);//三秒后关闭弹窗
html += "<h1>可添加内容<h1>";
html += "</div>";
var bw = new BaseWindow();
bw.myHtml = html;
bw.myIsDisplayScroll = false;
bw.show();
setTimeout(bw.close, 3000);//三秒后关闭弹窗
展示效果: