(function () {
CDK={
cfm:function(resFun,errFun){
var confirm=document.createElement('div');
confirm.setAttribute('style','position:fixed;top:0;left:0;width: 100%;height: 100%;z-index:99;background-color: rgba(0, 0, 0,0.3);');
$(confirm).addClass('confirmkuang');
$(confirm).html(
'<div class="addson" style="opacity:0;position:fixed;top:40%;left:40%;z-index: 9999;min-width:260px;max-width:260px;min-height:100px;margin:auto;background:#fff;border-radius:2px;color: #000;-moz-box-shadow:0px 0px 14px #858585; -webkit-box-shadow:0px 0px 14px #858585; box-shadow:0px 0px 14px #858585;"><div style="padding: 0 80px 0 20px;height: 42px;line-height: 42px;border-bottom: 1px solid #eee;font-size: 14px;color: #333;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;background-color: #F8F8F8;border-radius: 2px 2px 0 0;position: relative;">提示框<span style="position: absolute;right: 15px;font-size: 15px;cursor:pointer;" class="closealter">&#10006</span></div><p style="padding:10px;word-break: break-all; overflow: hidden; font-size: 16px;overflow-x: hidden;overflow-y: auto;">确定要执行此操作吗?</p><div style="text-align: right;padding: 0 15px 12px;"><button style="border-color: #1E9FFF;background-color: #1E9FFF;color: #fff;height: 28px;line-height: 28px;margin: 5px 5px 0;padding: 0 15px;border: 1px solid #dedede;border-radius:3px;font-weight: 400;cursor: pointer;text-decoration: none;" class="closealter addConfirm">确认</button><button style="height: 28px;line-height: 28px;margin: 5px 5px 0;padding: 0 15px;border: 1px solid #dedede;background-color: #fff;color: #333;border-radius:3px;font-weight: 400;cursor: pointer;text-decoration: none;" class="closealter">取消</button></div></div>'
)
$("body").append(confirm);
$('.addson').animate({'opacity':'1'},400)
$('.addConfirm').on('click',function(){ if (resFun){
resFun();
}
})
$('.closealter').on('click',function(event){
$('.addson').animate({'opacity':'0'},400)
setTimeout(function(){
$('.confirmkuang').remove()
},400)
})
}
}
})(jQuery);//(jQuery)代表jQuery执行完毕后

调用:

  js事件函数直接调用

CDK.cfm(res=>{
console.log('确认执行')
},err=>{
console.log('取消执行')
})
<button class="trigger">弹框</button>
<script type="text/javascript">
$(function(){
$('.trigger').on('click',function(){
CDK.cfm(res=>{
console.log('aa')
},err=>{
return
})
})
})
</script>

jQuery点击调用

最新文章

  1. 代码的坏味道(20)——过度耦合的消息链(Message Chains)
  2. PHP格式化显示文件大小函数
  3. [OC笔记]@property之个人理解,大神轻拍
  4. Scala 深入浅出实战经典 第53讲:Scala中结构类型实战详解
  5. CodeForces 546B C(Contest #1)
  6. WPF多线程演示
  7. as3判断XML是否合法
  8. 一台Ubuntu server上安装多实例MySQL
  9. Android开发手记(7) 按钮类控件的使用
  10. CDZSC_2015寒假新人(2)——数学 H
  11. Android 5.0之应用中实现材料设计—Material Design
  12. org.springframework.data.redis.serializer.SerializationException: Cannot serialize;
  13. 【luogu3384】【模板】树链剖分
  14. TPshop之邮箱注册配置教程--附加常见问题集合
  15. k8s部署prometheus
  16. MySQL Load Data InFile 数据导入数据库
  17. 按键显示按键编码 keycode
  18. mysql完装成功后的提示。
  19. kbmMW均衡负载与容灾(1)(转载红鱼儿)
  20. 解决IE下select option不支持display none样式

热门文章

  1. SurfaceFlinger与Surface概述
  2. QT获取主机名称
  3. PHP核心编程--文件上传(包含多文件上传)
  4. Python接口自动化(二)接口开发
  5. nodeJs koa-generator脚手架
  6. Spring → 01:概述
  7. python 对象的封装性
  8. java读取properties文件总结
  9. windows7蓝屏0x000000c4
  10. 二 virtualenv与virtualenvwrapper