揭阳网站制作托管苏州网站建设caiyiduo

news/2025/10/1 20:17:17/文章来源:
揭阳网站制作托管,苏州网站建设caiyiduo,wordpress悬浮小人,cms适合做什么网站一、Bootstrap弹出框使用过JQuery UI应该知道#xff0c;它里面有一个dialog的弹出框组件#xff0c;功能也很丰富。与jQuery UI的dialog类似#xff0c;Bootstrap里面也内置了弹出框组件。打开bootstrap 文档可以看到它的dialog是直接嵌入到bootstrap.js和bootstrap.css里面…一、Bootstrap弹出框使用过JQuery UI应该知道它里面有一个dialog的弹出框组件功能也很丰富。与jQuery UI的dialog类似Bootstrap里面也内置了弹出框组件。打开bootstrap 文档可以看到它的dialog是直接嵌入到bootstrap.js和bootstrap.css里面的也就是说只要我们引入了bootstrap的文件就可以直接使用它的dialog组件是不是很方便。本篇我们就结合新增编辑的功能来介绍下bootstrap dialog的使用。废话不多说直接看来它如何使用吧。1、cshtml界面代码 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 div classmodal fade idmyModal tabindex-1 roledialog aria-labelledbymyModalLabel   div classmodal-dialog roledocument    div classmodal-content     div classmodal-header      button typebutton classclose data-dismissmodal aria-labelClosespan aria-hiddentrue×/span/button      h4 classmodal-title idmyModalLabel新增/h4     /div     div classmodal-body      div classform-group       label fortxt_departmentname部门名称/label       input typetext nametxt_departmentname classform-control idtxt_departmentname placeholder部门名称      /div      div classform-group       label fortxt_parentdepartment上级部门/label       input typetext nametxt_parentdepartment classform-control idtxt_parentdepartment placeholder上级部门      /div      div classform-group       label fortxt_departmentlevel部门级别/label       input typetext nametxt_departmentlevel classform-control idtxt_departmentlevel placeholder部门级别      /div      div classform-group       label fortxt_statu描述/label       input typetext nametxt_statu classform-control idtxt_statu placeholder状态      /div     /div     div classmodal-footer      button typebutton classbtn btn-default data-dismissmodalspan classglyphicon glyphicon-remove aria-hiddentrue/span关闭/button      button typebutton idbtn_submit classbtn btn-primary data-dismissmodalspan classglyphicon glyphicon-floppy-disk aria-hiddentrue/span保存/button     /div    /div   /div  /div 最外面的div定义了dialog的隐藏。我们重点来看看第二层的div ? 1 div classmodal-dialog roledocument 这个div定义了dialog对应的class有三种尺寸的弹出框如下 ? 1 2 3 div classmodal-dialog roledocument div classmodal-dialog modal-lg roledocument div classmodal-dialog modal-full roledocument 第一种表示默认类型的弹出框第二种表示增大的弹出框第三种表示满屏的弹出框。roledocument表示弹出框的对象的当前的document。 2、js里面将dialog show出来。默认情况下我们的弹出框是隐藏的只有在用户点击某个操作的时候才会show出来。来看看js里面是如何处理的吧 ? 1 2 3 4 5 //注册新增按钮的事件  $(#btn_add).click(function () {   $(#myModalLabel).text(新增);   $(#myModal).modal();  }); 对你没有看错只需要这一句就能show出这个dialog. ? 1 $(#myModal).modal(); 3、效果展示新增效果 编辑效果 4、说明弹出框显示后点击界面上其他地方以及按Esc键都能隐藏弹出框这样使得用户的操作更加友好。关于dialog里面关闭和保存按钮的事件的初始化在项目里面一般是封装过的这个我们待会来看。 二、确认取消提示框这种类型的提示框一般用于某些需要用户确定才能进行的操作比较常见的如删除操作、提交订单操作等。 1、使用bootstrap弹出框确认取消提示框介绍这个组件之前就得说说组件封装了我们知道像弹出框、确认取消提示框、信息提示框这些东西项目里面肯定是多处都要调用的所以我们肯定是要封装组件的。下面就来看看我们封装的缺乏取消提示框。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 (function ($) {  window.Ewin function () {   var html div id[Id] classmodal fade roledialog aria-labelledbymodalLabel         div classmodal-dialog modal-sm          div classmodal-content           div classmodal-header            button typebutton classclose data-dismissmodalspan aria-hiddentrue×/spanspan classsr-onlyClose/span/button            h4 classmodal-title idmodalLabel[Title]/h4           /div           div classmodal-body           p[Message]/p           /div           div classmodal-footer   button typebutton classbtn btn-default cancel data-dismissmodal[BtnCancel]/button   button typebutton classbtn btn-primary ok data-dismissmodal[BtnOk]/button  /div          /div         /div        /div;   var dialogdHtml div id[Id] classmodal fade roledialog aria-labelledbymodalLabel         div classmodal-dialog          div classmodal-content           div classmodal-header            button typebutton classclose data-dismissmodalspan aria-hiddentrue×/spanspan classsr-onlyClose/span/button            h4 classmodal-title idmodalLabel[Title]/h4           /div           div classmodal-body           /div          /div         /div        /div;   var reg new RegExp(\\[([^\\[\\]]*?)\\], igm);   var generateId function () {    var date new Date();    return mdl date.valueOf();   }   var init function (options) {    options $.extend({}, {     title: 操作提示,     message: 提示内容,     btnok: 确定,     btncl: 取消,     width: 200,     auto: false    }, options || {});    var modalId generateId();    var content html.replace(reg, function (node, key) {     return {      Id: modalId,      Title: options.title,      Message: options.message,      BtnOk: options.btnok,      BtnCancel: options.btncl     }[key];    });    $(body).append(content);    $(# modalId).modal({     width: options.width,     backdrop: static    });    $(# modalId).on(hide.bs.modal, function (e) {     $(body).find(# modalId).remove();    });    return modalId;   }   return {    alert: function (options) {     if (typeof options string) {      options {       message: options      };     }     var id init(options);     var modal $(# id);     modal.find(.ok).removeClass(btn-success).addClass(btn-primary);     modal.find(.cancel).hide();     return {      id: id,      on: function (callback) {       if (callback callback instanceof Function) {        modal.find(.ok).click(function () { callback(true); });       }      },      hide: function (callback) {       if (callback callback instanceof Function) {        modal.on(hide.bs.modal, function (e) {         callback(e);        });       }      }     };    },    confirm: function (options) {     var id init(options);     var modal $(# id);     modal.find(.ok).removeClass(btn-primary).addClass(btn-success);     modal.find(.cancel).show();     return {      id: id,      on: function (callback) {       if (callback callback instanceof Function) {        modal.find(.ok).click(function () { callback(true); });        modal.find(.cancel).click(function () { callback(false); });       }      },      hide: function (callback) {       if (callback callback instanceof Function) {        modal.on(hide.bs.modal, function (e) {         callback(e);        });       }      }     };    },    dialog: function (options) {     options $.extend({}, {      title: title,      url: ,      width: 800,      height: 550,      onReady: function () { },      onShown: function (e) { }     }, options || {});     var modalId generateId();     var content dialogdHtml.replace(reg, function (node, key) {      return {       Id: modalId,       Title: options.title      }[key];     });     $(body).append(content);     var target $(# modalId);     target.find(.modal-body).load(options.url);     if (options.onReady())      options.onReady.call(target);     target.modal();     target.on(shown.bs.modal, function (e) {      if (options.onReady(e))       options.onReady.call(target, e);     });     target.on(hide.bs.modal, function (e) {      $(body).find(target).remove();     });    }   }  }(); })(jQuery); 不了解组件封装的朋友可以先看看相关文章。这里我们的确认取消提示框主要用到了confirm这个属性对应的方法。还是来看看如何调用吧 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 //注册删除按钮的事件 $(#btn_delete).click(function () {   //取表格的选中行数据   var arrselections $(#tb_departments).bootstrapTable(getSelections);   if (arrselections.length 0) {    toastr.warning(请选择有效数据);    return;   }   Ewin.confirm({ message: 确认要删除选择的数据吗 }).on(function (e) {    if (!e) {     return;    }    $.ajax({     type: post,     url: /api/DepartmentApi/Delete,     data: { : JSON.stringify(arrselections) },     success: function (data, status) {      if (status success) {       toastr.success(提交数据成功);       $(#tb_departments).bootstrapTable(refresh);      }     },     error: function () {      toastr.error(Error);     },     complete: function () {     }    });   });  }); message属性传入提示的信息on里面注入点击按钮后的回调事件。 生成的效果 2、bootbox组件的使用在网上找bootstrap的弹出组件时总是可以看到bootbox这么一个东西确实是一个很简单的组件还是来看看如何使用吧。 当然要使用它必须要添加组件喽。无非也是两种方式引入源码和Nuget。 接下来就是使用它了。首先当然是添加bootbox.js的引用了。然后就是在相应的地方调用了。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 $(#btn_delete).click(function () {    var arrselections $(#tb_departments).bootstrapTable(getSelections);    if (arrselections.length 0) {     toastr.warning(请选择有效数据);     return;    }    bootbox.alert(确认删除, function () {     var strResult ;    })    bootbox.prompt(确认删除, function (result) {     var strResult result;    })    bootbox.confirm(确认删除, function (result) {     var strResult result;    })        }); 效果展示 更多用法可以参见api。使用起来基本很简单。这个组件最大的特点就是和bootstrap的风格能够很好的保持一致。 3、在网上还找到一个效果比较炫一点的提示框sweetalert   要使用它还是老规矩Nuget。 1文档 2在cshtml页面引入js和css     link href~/Styles/sweetalert.css relstylesheet /    script src~/Scripts/sweetalert.min.js/script3js使用      ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 swal({    title: 操作提示,  //弹出框的title    text: 确定删除吗, //弹出框里面的提示文本    type: warning,  //弹出框类型    showCancelButton: true, //是否显示取消按钮    confirmButtonColor: #DD6B55,//确定按钮颜色    cancelButtonText: 取消,//取消按钮文本    confirmButtonText: 是的确定删除,//确定按钮上面的文档    closeOnConfirm: true   }, function () {     $.ajax({      type: post,      url: /Home/Delete,      data: { : JSON.stringify(arrselections) },      success: function (data, status) {       if (status success) {        toastr.success(提交数据成功);        $(#tb_departments).bootstrapTable(refresh);       }      },      error: function () {       toastr.error(Error);      },      complete: function () {      }     });   }); 4效果展示 点击确定后进入回调函数 组件很多用哪种园友没可以自行决定不过博主觉得像一些互联网、电子商务类型的网站用sweetalert效果比较合适一般的内部系统可能也用不上。 三、操作完成提示框1、toastr.js组件关于信息提示框博主项目中使用的是toastr.js这么一个组件这个组件最大的好处就是异步、无阻塞提示后可设置消失时间并且可以将消息提示放到界面的各个地方。先来看看效果。 显示在不同位置 top-center位置 bottom-left位置 关于它的使用。 1、引入js和css  ? 1 2 link href~/Content/toastr/toastr.css relstylesheet / script src~/Content/toastr/toastr.min.js/script 2、js初始化 ? 1 2 3 script typetext/javascript   toastr.options.positionClass toast-bottom-right;  /script 将这个属性值设置为不同的值就能让提示信息显示在不同的位置如toast-bottom-right表示下右、toast-bottom-center表示下中、toast-top-center表示上中等更过位置信息请查看文档。 3、使用 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 //初始化编辑按钮 $(#btn_edit).click(function () {    var arrselections $(#tb_departments).bootstrapTable(getSelections);    if (arrselections.length 1) {     toastr.warning(只能选择一行进行编辑);     return;    }    if (arrselections.length 0) {     toastr.warning(请选择有效数据);     return;    }         $(#myModal).modal();   }); 使用起来就如下一句 toastr.warning(只能选择一行进行编辑);是不是很简单~~这里的有四种方法分别对应四种不同颜色的提示框。 toastr.success(提交数据成功);toastr.error(Error);toastr.warning(只能选择一行进行编辑);toastr.info(info);分别对应上图中的四种颜色的提示框。 2、Messenger组件在Bootstrap中文网里面提到了一个alert组件Messenger。 它的使用和toastr.js这个组件基本相似只不过效果有点不太一样。我们还是来看看它是如何使用的。 1效果展示 可以定位到网页的不同位置例如下图中给出的下中位置、上中位置。 提示框的样式有三种状态Success、Error、Info 并且支持四种不同样式的提示框Future、Block、Air、Ice 2组件使用以及代码示例 关于它的使用和toastr大同小异首先引入组件 ? 1 2 3 script src~/Content/HubSpot-messenger-a3df9a6/build/js/messenger.js/script  link href~/Content/HubSpot-messenger-a3df9a6/build/css/messenger.css relstylesheet /  link href~/Content/HubSpot-messenger-a3df9a6/build/css/messenger-theme-future.css relstylesheet / 初始化它的位置 ? 1 2 3 4 5 script typetext/javascript  $._messengerDefaults {   extraClasses: messenger-fixed messenger-theme-future messenger-on-bottom messenger-on-right  } /script 然后js里面使用如下 ? 1 2 3 4 5 6 7 8 9 $(#btn_delete).click(function () {   $.globalMessenger().post({    message: 操作成功,//提示信息    type: info,//消息类型。error、info、success    hideAfter: 2,//多长时间消失    showCloseButton:true,//是否显示关闭按钮    hideOnNavigate: true //是否隐藏导航  }); }); 如果提示框使用默认样式也只有一句就能解决  ? 1 2 3 4 $.globalMessenger().post({    message: 操作成功,//提示信息    type: info,//消息类型。error、info、success  }); 很简单很强大有木有~~转载于:https://www.cnblogs.com/hofmann/p/6272513.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/924241.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

火锅网站建设家政服务网站建设方案

单例模式,是设计模式的一种。 在计算机这个圈子中,大佬们针对一些典型的场景,给出了一些典型的解决方案。 目录 单例模式 饿汉模式 懒汉模式 线程安全 单例模式 单例模式又可以理解为是单个实例(对象) 在有些场…

链表实现双端队列

链表实现双端队列定义链表class ListNode: def __init__(self, value): self.val = value # 节点存储的值 self.prev = None # 指向前一个节点的指针 self.next = None # 指向后一个节点的指针定义双端队列clas…

专门做朋友圈小视频的网站网站怎么做404

PHP是一种服务器端、跨平台、html嵌入式的脚本语言执行速度快:PHP是一种强大的CGI脚本语言,语法混合了C、Java、Perl和PHP式的新语法,执行网页比CGI、Perl和ASP更快,这是它的第一个突出的特点。 (推荐学习:PHP视频教程…

怎么做58同城网站西安英文旅游网站建设

本文实例讲述了Java模拟计算机的整数乘积计算功能。分享给大家供大家参考,具体如下:计算机计算整数乘积的原理:实现代码:package math;public class two {/*** Fundamental method* f(n) O(n^2)* param a* param b* return*/publ…

网站建设开发制作免费游戏网站制作

哈喽小伙伴们大家好,本系列是一个专门针对前端开发岗的面试题系列,每周将会不定期分享一些面试题,希望对大家有所帮助. 面试官:token 一般在客户端存在哪儿 求职者:Token一般在客户端存在以下几个地方: (1)Cookie:Token可以存储在客户端的Cookie中。服…

深入解析:数字和字节:Linux 中的内存如何工作?

深入解析:数字和字节:Linux 中的内存如何工作?pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas",…

FFmpeg和ZLMediaKit 实现本地视频推流

目录1 本地视频推流1.1 简介1.1.1 FFmpeg1.1.2 ZLMediaKit1.2 环境准备1.2.1 ZLMediaKit 安装配置1.2.2 FFmpeg 安装(可选)1.3 整合1.3.1 pom和配置1.3.2 推流配置类1.3.3 推流服务类1.3.4 前端部分 1 本地视频推流 …

SQL 多表查询速查:JOIN、子查询一文全掌握 - 详解

SQL 多表查询速查:JOIN、子查询一文全掌握 - 详解pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas"…

MySQL复合查询(重点) - 详解

MySQL复合查询(重点) - 详解pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco"…

网站备案期间可以建站荣欣建设集团有限公司网站

目录 1.应用场景2.类似的数据同步工具3.DataX 与 Canal 有什么区别 DataX是阿里巴巴开源的一款数据同步工具,使用Java语言开发的。它提供了从各类数据源读取数据以及向各类数据源写入数据的功能,支持包括MySQL、Oracle、SQLServer、PostgreSQL、HDFS、HB…

14.单臂路由(2025年9月29日) - 教程

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

AtCoder Beginner Contest 424 425 部分题解

ABC424E注意到,若两根木棍长度相同,那么它们被操作的顺序也是相邻的。于是,若两根木棍“来源”相同,那么它们始终在同一“批次”中被操作。例如:\([1] \to [1/2, 1/2] \to [1/4, 1/4, 1/2] \to [1/4, 1/4, 1/4, 1…

网站怎么识别PC 手机装修设计灵感网站

文章目录 串的模式匹配 考纲内容 复习提示 1.简单的模式匹配算法 知识回顾 2.串的模式匹配算法——KMP算法 2.1字符串的前缀、后缀和部分匹配值 2.2KMP算法的原理是什么 3.KMP算法的进一步优化 串的模式匹配 考纲内容 字符串模式匹配 复习提示 本章是统考大纲第6章内…

【C++】Visual Studio+CMake 开发 C++ 入门指南:从环境搭建到项目实战 - 详解

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

学习:uniapp全栈微信小程序vue3后台-额外/精彩报错篇 - 教程

学习:uniapp全栈微信小程序vue3后台-额外/精彩报错篇 - 教程2025-10-01 20:04 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !import…

织梦配置手机网站手机企业网站怎么做

0x01 初识NTLM协议 基本概念:NTLM(NT LAN Manager)认证是一种早期的Windows网络身份认证协议。它在Windows系统中用于验证用户的身份,并提供对网络资源的访问控制,它是一种基于Challenge/Response的认证机制。 认证流程 NTLM协议Challenge…

关于滚动数组

i & 1 还是太丑陋了,可以设一个 ind,每次 i++ 时 ind = 1 - ind。 i + 1 就是 1 - ind。

第九篇

今天是10月1日,ok也是终于等到了国庆节放假,不容易啊,坐了十几个小时的火车终于是顺利到家了。

2025 年宁波搬家公司推荐 TOP 权威榜单发布,多维度解读宁波搬家服务公司创新亮点举措

引言 在宁波这座不断发展的城市,搬家服务需求日益增长,但行业内却存在不少亟待解决的问题。部分小型搬家团队缺乏规范管理,服务质量参差不齐,常常出现物品损坏后推诿责任、坐地起价等现象,让消费者蒙受损失。有的…

2025 年检测器厂家推荐 TOP 品牌权威排名,防爆火焰 / 一体化火焰 / 紫外线火焰 / 离子火焰 / 红外线火焰 / 红紫外复合火焰 / 智能火焰检测器公司推荐

引言 在工业生产、能源供应、环境保护等众多领域,检测器作为关键的监测设备,其性能与质量直接关系到生产安全、效率及数据准确性。当前,检测器市场品牌众多,产品种类繁杂,技术水平参差不齐。部分厂家为追求短期利…