DDR爱好者之家 Design By 杰米
本文实例为大家分享了js自定义弹出窗口效果展示的具体代码,供大家参考,具体内容如下
效果图:
源码:
1.demo.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>自定义弹出窗口</title> <script type="text/javascript" src="/UploadFiles/2021-04-02/myLayer.js">2.myLayer.js
/** * Created by zhuwenqi on 2017/6/16. */ /** * @param options 弹窗基本配置信息 * @constructor 构造方法 */ function MyLayer(options) { this.options = options ; } /** * 打开弹窗 */ MyLayer.prototype.openLayer = function () { var background_layer = document.createElement("div"); background_layer.style.display = "none"; background_layer.style.position = "absolute"; background_layer.style.top = "0px"; background_layer.style.left = "0px"; background_layer.style.width = "100%"; background_layer.style.height = "100%"; background_layer.style.backgroundColor = "gray"; background_layer.style.zIndex = "1001"; background_layer.style.opacity = "0.8" ; var open_layer = document.createElement("div"); open_layer.style.display = "none"; open_layer.style.position = "absolute"; open_layer.style.top = this.options.top === undefined "10%" : this.options.top; open_layer.style.left = this.options.left === undefined "10%" :this.options.left; open_layer.style.width = this.options.width === undefined "80%" : this.options.width; open_layer.style.height = this.options.height === undefined "80%" : this.options.height; open_layer.style.border = "1px solid lightblue"; open_layer.style.borderRadius = "15px" ; open_layer.style.boxShadow = "4px 4px 10px #171414"; open_layer.style.backgroundColor = "white"; open_layer.style.zIndex = "1002"; open_layer.style.overflow = "auto"; var div_toolBar = document.createElement("div"); div_toolBar.style.textAlign = "right"; div_toolBar.style.paddingTop = "10px" ; div_toolBar.style.backgroundColor = "aliceblue"; div_toolBar.style.height = "40px"; var span_title = document.createElement("span"); span_title.style.fontSize = "18px"; span_title.style.color = "blue" ; span_title.style.float = "left"; span_title.style.marginLeft = "20px"; var span_title_content = document.createTextNode(this.options.title === undefined "" : this.options.title); span_title.appendChild(span_title_content); div_toolBar.appendChild(span_title); var span_close = document.createElement("span"); span_close.style.fontSize = "16px"; span_close.style.color = "blue" ; span_close.style.cursor = "pointer"; span_close.style.marginRight = "20px"; span_close.onclick = function () { open_layer.style.display = "none"; background_layer.style.display = "none"; }; var span_close_content = document.createTextNode("关闭"); span_close.appendChild(span_close_content); div_toolBar.appendChild(span_close); open_layer.appendChild(div_toolBar); var div_content = document.createElement("div"); div_content.style.textAlign = "center"; var content_area = document.createTextNode(this.options.content === undefined "" : this.options.content); div_content.appendChild(content_area); open_layer.appendChild(div_content); document.body.appendChild(open_layer); document.body.appendChild(background_layer); open_layer.style.display = "block" ; background_layer.style.display = "block"; };以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2024年11月27日
2024年11月27日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]