zoukankan      html  css  js  c++  java
  • JS 功能弹框封装

    // 功能提示弹框
    function messageBox ( option ) {
    	var html = '';
    	html += '<div class="message-box-head">' + option.title;
    	html += '<i class="icon iconfont message-close">�</i></div>';
    
    	if ( option.type == 'using' ) {
    		html += '<div class="message-box-body">';
    		html += '<p class="message-prompt">' + option.content + '</p>';
    		html += '</div>';
    	}
    	else if ( option.type == 'disable' ) {
    		html += '<div class="message-box-body">';
    		html += '<p class="message-prompt">' + option.content + '</p>';
    		html += '</div>';
    	}
    	else if ( option.type == 'confirm' ) {
    		html += '<div class="message-box-body reset-pwd">';
    		html += '<p class="message-prompt">' + option.content + '</p>';
    		html += '<div class="message-btn por">';
    		html += '<button class="btn-common btn-gray cancel-btn poa">取消</button>';
    		html += '<button class="btn-common btn-blue yes-btn poa">确定</button>';
    		html += '</div>';
    		html += '</div>';
    	}
    	else if ( option.type == 'confirm2' ) {
    		html += '<div class="message-box-body confirm-spec">';
    		html += '<div class="message-prompt">';
    		html += '<p>'+ option.contentTitle +'</p>';
    		html += '<p>'+ option.content +'</p>';
    		html += '</div>';
    		html += '<div class="message-btn por">';
    		html += '<button class="btn-common btn-gray cancel-btn poa">取消</button>';
    		html += '<button class="btn-common btn-blue yes-btn poa">确定</button>';
    		html += '</div>';
    		html += '</div>';
    	}
    
    	$(".message-box-main").empty().append(html);
    	$(".message-box").addClass('show');
    
    	// 点击取消事件
    	$(".cancel-btn").click(function () {
    		$(".message-box").removeClass('show');
    		if ( option.cancel ) {
    			option.cancel();
    		}
    	});
    
    	// 点击确定事件
    	$(".yes-btn").click(function () {
    		$(".message-box").removeClass('show');
    		if ( option.sureFun ) {
    			option.sureFun();
    		}
    	});
    
    	// 点击图标取消事件
    	$(".message-close").click(function () {
    		$(".message-box").removeClass('show');
    		if ( option.callBack ) {
    			option.callBack();
    		}
    	});
    
    
    }
    

      

      

  • 相关阅读:
    默认值设置
    关于设置 存储 内部存储空间只显示图片不显示视频的解决方法
    sd卡的监听
    android 设置时间12/24小时制
    详解BMP木马
    C#中类和接口的设计思想(本人认为比较好的思想,欢迎大家讨论指点)
    从XML中读取数据到内存的实例
    如何在代码中通过命令行创建SQL SERVER 数据库
    Visual Studio 2005 新特性 之 可空类型
    install shield11.5 如何制作卸载程序
  • 原文地址:https://www.cnblogs.com/zsongs/p/6001194.html
Copyright © 2011-2022 走看看