分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

js公共弹出窗插件

发布时间:2023-09-06 01:44责任编辑:赖小花关键词:js
/*错误提示框*/var wr = function() { ???var wrap = ‘<div class="wrapBox opacity">&nbsp;</div>‘; ???var callback; ???var me = this; ???var htmlBox = ‘<div class="alertBox opacity"></div>‘; ???// 遮罩显示 ???me.faIn = function faIn(callback) { ???????$(‘body‘).append(wrap); ???????$(wrap).fadeIn(150, function() { ???????????$(‘.bodyBox‘).addClass(‘overAuto‘); ???????????if (callback) { ???????????????callback(); ???????????} ???????????; ???????}); ???}; ???// 遮罩隐藏 ???me.faOut = function(callback) { ???????$(‘.wrapBox‘).fadeOut(150, function() { ???????????$(‘.bodyBox‘).removeClass(‘overAuto‘); ???????????if (callback) { ???????????????callback(); ???????????} ???????????; ???????????$(this).remove(); ???????}); ???}; ???// 公共提示框 ???me.alert = function(message, callback) { ???????if(message){ ???????????var pHtml = ‘<p>‘ + message + ‘</p>‘; ???????????var inhtml = $(htmlBox).append(pHtml); ???????????$(‘body‘).append(inhtml); ???????????$(inhtml).fadeIn(250, function() { ???????????????setTimeout(function() { ???????????????????$(inhtml).fadeOut(150, function() { ???????????????????????$(this).html(‘‘); ???????????????????????$(this).remove(); ???????????????????}); ???????????????????if (callback) { ???????????????????????callback(); ???????????????????} ???????????????}, 2000); ???????????}); ???????} ???}; ???me.alertHide=function(){ ???????$(‘body‘).find(‘.alertBox‘).fadeOut(0,function(){ ???????????$(this).html(‘‘); ???????????$(this).remove(); ???????}); ???}; ???// 电话 ???me.tel = function(tel, callback) { ???????var tel = ‘<p class="telBox"><a href="tel:‘ + tel + ‘">‘ + tel ???????????+ ‘</a></p>‘; ???????if (callback) { ???????????callback(); ???????} ???????$(‘body‘).append(htmlBox); ???????$(‘body‘).append(tel); ???????$(htmlBox).fadeIn(250); ???????$(‘.alertBox‘).click(function() { ???????????$(‘.telBox‘).fadeOut(150, function() { ???????????????$(this).remove(); ???????????}); ???????????$(this).fadeOut(0, function() { ???????????????$(this).html(‘‘); ???????????????$(this).remove(); ???????????}); ???????}); ???};};var wrap = new wr();

js公共弹出窗插件

原文地址:https://www.cnblogs.com/AttackLion/p/8492083.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved