17 Star 128 Fork 33

笔下光年/Light Year Admin v5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_components_modal.html 85.98 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2022-11-06 18:42 . 上传新项目文件
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>模态框 - 光年(Light Year Admin V5)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
</head>
<body>
<!--页面loading-->
<div id="lyear-preloader" class="loading">
<div class="ctn-preloader">
<div class="round_spinner">
<div class="spinner"></div>
<img src="images/loading-logo.png" alt="">
</div>
</div>
</div>
<!--页面loading end-->
<div class="lyear-layout-web">
<div class="lyear-layout-container">
<!--左侧导航-->
<aside class="lyear-layout-sidebar">
<!-- logo -->
<div id="logo" class="sidebar-header">
<a href="index.html"><img src="images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
</div>
<div class="lyear-layout-sidebar-info lyear-scroll">
<nav class="sidebar-main">
<ul class="nav-drawer">
<li class="nav-item">
<a href="index.html">
<i class="mdi mdi-home-city-outline"></i>
<span>后台首页</span>
</a>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-television-guide"></i>
<span>布局</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_layout_break_point.html">拐点</a> </li>
<li> <a href="lyear_layout_containers.html">容器</a> </li>
<li> <a href="lyear_layout_grid.html">栅格</a> </li>
<li> <a href="lyear_layout_columns.html"></a> </li>
<li> <a href="lyear_layout_gutters.html">沟槽</a> </li>
<li> <a href="lyear_layout_utilities.html">实用程序</a> </li>
<li> <a href="lyear_layout_zindex.html">Z-index</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-silo"></i>
<span>页面内容</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_content_typography.html">排版</a> </li>
<li> <a href="lyear_content_images.html">图片</a> </li>
<li> <a href="lyear_content_tables.html">表格</a> </li>
<li> <a href="lyear_content_figures.html">画像</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-map-outline"></i>
<span>表单</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_forms_overview.html">概述</a> </li>
<li> <a href="lyear_forms_control.html">表单控件</a> </li>
<li> <a href="lyear_forms_select.html">下拉选择</a> </li>
<li> <a href="lyear_forms_radio.html">单选框</a> </li>
<li> <a href="lyear_forms_checkbox.html">复选框</a> </li>
<li> <a href="lyear_forms_switch.html">开关</a> </li>
<li> <a href="lyear_forms_range.html">范围</a> </li>
<li> <a href="lyear_forms_input_group.html">输入组</a> </li>
<li> <a href="lyear_forms_floating_labels.html">浮动标签</a> </li>
<li> <a href="lyear_forms_layout.html">布局</a> </li>
<li> <a href="lyear_forms_validation.html">验证</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav active open">
<a href="javascript:void(0)">
<i class="mdi mdi-tune"></i>
<span>组件</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_components_accordion.html">手风琴菜单</a> </li>
<li> <a href="lyear_components_alerts.html">警告框</a> </li>
<li> <a href="lyear_components_badge.html">徽章</a> </li>
<li> <a href="lyear_components_breadcrumb.html">面包屑导航</a> </li>
<li> <a href="lyear_components_buttons.html">按钮</a> </li>
<li> <a href="lyear_components_button_group.html">按钮组</a> </li>
<li> <a href="lyear_components_card.html">卡片</a> </li>
<li> <a href="lyear_components_carousel.html">轮播</a> </li>
<li> <a href="lyear_components_close_button.html">关闭按钮</a> </li>
<li> <a href="lyear_components_collapse.html">折叠</a> </li>
<li> <a href="lyear_components_dropdowns.html">下拉菜单</a> </li>
<li> <a href="lyear_components_list_group.html">列表组</a> </li>
<li class="active"> <a href="lyear_components_modal.html">模态框</a> </li>
<li> <a href="lyear_components_navs_tabs.html">导航 &amp; 标签页</a> </li>
<li> <a href="lyear_components_navbar.html">导航栏</a> </li>
<li> <a href="lyear_components_offcanvas.html">滑动容器</a> </li>
<li> <a href="lyear_components_pagination.html">分页</a> </li>
<li> <a href="lyear_components_placeholders.html">占位符</a> </li>
<li> <a href="lyear_components_popovers.html">POP提示</a> </li>
<li> <a href="lyear_components_progress.html">进度条</a> </li>
<li> <a href="lyear_components_scrollspy.html">滚动监听</a> </li>
<li> <a href="lyear_components_spinners.html">加载状态</a> </li>
<li> <a href="lyear_components_toasts.html">通知消息</a> </li>
<li> <a href="lyear_components_tooltips.html">工具提示</a> </li>
<li> <a href="lyear_components_other.html">其他</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-card-bulleted-outline"></i>
<span>助手</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_helpers_clearfix.html">清除浮动</a> </li>
<li> <a href="lyear_helpers_colored_links.html">彩色链接</a> </li>
<li> <a href="lyear_helpers_ratio.html">比例</a> </li>
<li> <a href="lyear_helpers_position.html">定位</a> </li>
<li> <a href="lyear_helpers_stacks.html">堆叠</a> </li>
<li> <a href="lyear_helpers_visually_hidden.html">视觉隐藏</a> </li>
<li> <a href="lyear_helpers_stretched_link.html">延伸链接</a> </li>
<li> <a href="lyear_helpers_text_truncation.html">文本截断</a> </li>
<li> <a href="lyear_helpers_vertical_rule.html">垂直法则</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-map-search-outline"></i>
<span>工具类</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_utilities_background.html">背景</a> </li>
<li> <a href="lyear_utilities_borders.html">边框</a> </li>
<li> <a href="lyear_utilities_colors.html">颜色</a> </li>
<li> <a href="lyear_utilities_display.html">显示属性</a> </li>
<li> <a href="lyear_utilities_flex.html">弹性布局</a> </li>
<li> <a href="lyear_utilities_float.html">浮动</a> </li>
<li> <a href="lyear_utilities_interactions.html">交互</a> </li>
<li> <a href="lyear_utilities_opacity.html">透明度</a> </li>
<li> <a href="lyear_utilities_overflow.html">溢出处理</a> </li>
<li> <a href="lyear_utilities_position.html">定位</a> </li>
<li> <a href="lyear_utilities_shadows.html">阴影</a> </li>
<li> <a href="lyear_utilities_sizing.html">尺寸</a> </li>
<li> <a href="lyear_utilities_spacing.html">间距</a> </li>
<li> <a href="lyear_utilities_text.html">文本</a> </li>
<li> <a href="lyear_utilities_vertical_align.html">垂直对齐</a> </li>
<li> <a href="lyear_utilities_visibility.html">可见性</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-stove"></i>
<span>示例页面</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_pages_doc.html">文档列表</a> </li>
<li> <a href="lyear_pages_table.html">表格插件</a> </li>
<li> <a href="lyear_pages_gallery.html">图库列表</a> </li>
<li> <a href="lyear_pages_config.html">网站配置</a> </li>
<li> <a href="lyear_pages_rabc.html">设置权限</a> </li>
<li> <a href="lyear_pages_add_doc.html">新增文档</a> </li>
<li> <a href="lyear_pages_login_1.html" target="_blank">登录页面1</a> </li>
<li> <a href="lyear_pages_login_2.html" target="_blank">登录页面2</a> </li>
<li> <a href="lyear_pages_login_3.html" target="_blank">登录页面3</a> </li>
<li> <a href="lyear_pages_login_4.html" target="_blank">登录页面4</a> </li>
<li> <a href="lyear_pages_error.html">错误页面</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-card-text-outline"></i>
<span>其他内容</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_other_icons.html">图标</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-file-code-outline"></i>
<span>JS 插件</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="lyear_pages_guide.html">表单向导</a> </li>
<li> <a href="lyear_js_datepicker.html">日期选取器</a> </li>
<li> <a href="lyear_js_colorpicker.html">选色器</a> </li>
<li> <a href="lyear_js_chartjs.html">Chart.js</a> </li>
<li> <a href="lyear_js_jconfirm.html">对话框</a> </li>
<li> <a href="lyear_js_tags_input.html">标签插件</a> </li>
<li> <a href="lyear_js_notify.html">通知消息</a> </li>
<li> <a href="lyear_js_maxlength.html">长度判断</a> </li>
<li> <a href="lyear_js_select.html">下拉选择</a> </li>
<li> <a href="lyear_js_fullcalendar.html">日程插件</a> </li>
<li> <a href="lyear_js_loading.html">loading插件</a> </li>
</ul>
</li>
<li class="nav-item nav-item-has-subnav">
<a href="javascript:void(0)">
<i class="mdi mdi-folder-text-outline"></i>
<span>多级菜单</span>
</a>
<ul class="nav nav-subnav">
<li> <a href="#!">一级菜单</a> </li>
<li class="nav-item nav-item-has-subnav">
<a href="#!">一级菜单</a>
<ul class="nav nav-subnav">
<li> <a href="#!">二级菜单</a> </li>
<li class="nav-item nav-item-has-subnav">
<a href="#!">二级菜单</a>
<ul class="nav nav-subnav">
<li> <a href="#!">三级菜单</a> </li>
<li> <a href="#!">三级菜单</a> </li>
</ul>
</li>
</ul>
</li>
<li> <a href="#!">一级菜单</a> </li>
</ul>
</li>
</ul>
</nav>
<div class="sidebar-footer">
<p class="copyright">
<span>Copyright &copy; 2022. </span>
<a target="_blank" href="http://www.bixiaguangnian.com">笔下光年</a>
<span> All rights reserved.</span>
</p>
</div>
</div>
</aside>
<!--End 左侧导航-->
<!--头部信息-->
<header class="lyear-layout-header">
<nav class="navbar">
<div class="navbar-left">
<div class="lyear-aside-toggler">
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
<span class="lyear-toggler-bar"></span>
</div>
</div>
<ul class="navbar-right d-flex align-items-center">
<!--顶部消息部分-->
<li class="dropdown dropdown-notice">
<span data-bs-toggle="dropdown" class="position-relative icon-item">
<i class="mdi mdi-bell-outline fs-5"></i>
<span class="position-absolute translate-middle badge bg-danger">7</span>
</span>
<div class="dropdown-menu dropdown-menu-end">
<div class="lyear-notifications">
<div class="lyear-notifications-title d-flex justify-content-between" data-stopPropagation="true">
<span>你有 10 条未读消息</span>
<a href="#!">查看全部</a>
</div>
<div class="lyear-notifications-info lyear-scroll">
<a href="#!" class="dropdown-item"
title="树莓派销量猛增,疫情期间居家工作学习、医疗领域都需要它">树莓派销量猛增,疫情期间居家工作学习、医疗领域都需要它</a>
<a href="#!" class="dropdown-item"
title="GNOME 用户体验团队将为 GNOME Shell 提供更多改进">GNOME 用户体验团队将为 GNOME Shell
提供更多改进</a>
<a href="#!" class="dropdown-item"
title="Linux On iPhone 即将面世,支持 iOS 的双启动">Linux On iPhone 即将面世,支持 iOS
的双启动</a>
<a href="#!" class="dropdown-item" title="GitHub 私有仓库完全免费面向团队提供">GitHub
私有仓库完全免费面向团队提供</a>
<a href="#!" class="dropdown-item"
title="Wasmtime 为 WebAssembly 增加 Go 语言绑定">Wasmtime 为 WebAssembly 增加 Go
语言绑定</a>
<a href="#!" class="dropdown-item"
title="红帽借“订阅”成开源一哥,首创者 Cormier 升任总裁">红帽借“订阅”成开源一哥,首创者 Cormier 升任总裁</a>
<a href="#!" class="dropdown-item" title="Zend 宣布推出两项 PHP 新产品">Zend 宣布推出两项
PHP 新产品</a>
</div>
</div>
</div>
</li>
<!--End 顶部消息部分-->
<!--切换主题配色-->
<li class="dropdown dropdown-skin">
<span data-bs-toggle="dropdown" class="icon-item">
<i class="mdi mdi-palette fs-5"></i>
</span>
<ul class="dropdown-menu dropdown-menu-end" data-stopPropagation="true">
<li class="lyear-skin-title"><p>主题</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_1" value="default" checked="checked">
<label class="form-check-label" for="site_theme_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_2" value="translucent-green">
<label class="form-check-label" for="site_theme_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_3" value="translucent-blue">
<label class="form-check-label" for="site_theme_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_4" value="translucent-yellow">
<label class="form-check-label" for="site_theme_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_5" value="translucent-red">
<label class="form-check-label" for="site_theme_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_6" value="translucent-pink">
<label class="form-check-label" for="site_theme_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_7" value="translucent-cyan">
<label class="form-check-label" for="site_theme_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="site_theme" id="site_theme_8" value="dark">
<label class="form-check-label" for="site_theme_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>LOGO</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_1" value="default" checked="checked">
<label class="form-check-label" for="logo_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_2" value="color_2">
<label class="form-check-label" for="logo_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_3" value="color_3">
<label class="form-check-label" for="logo_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_4" value="color_4">
<label class="form-check-label" for="logo_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_5" value="color_5">
<label class="form-check-label" for="logo_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_6" value="color_6">
<label class="form-check-label" for="logo_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_7" value="color_7">
<label class="form-check-label" for="logo_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="logo_bg" id="logo_bg_8" value="color_8">
<label class="form-check-label" for="logo_bg_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>头部</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_1" value="default" checked="checked">
<label class="form-check-label" for="header_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_2" value="color_2">
<label class="form-check-label" for="header_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_3" value="color_3">
<label class="form-check-label" for="header_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_4" value="color_4">
<label class="form-check-label" for="header_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_5" value="color_5">
<label class="form-check-label" for="header_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_6" value="color_6">
<label class="form-check-label" for="header_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_7" value="color_7">
<label class="form-check-label" for="header_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="header_bg" id="header_bg_8" value="color_8">
<label class="form-check-label" for="header_bg_8"></label>
</div>
</li>
<li class="lyear-skin-title"><p>侧边栏</p></li>
<li class="lyear-skin-li clearfix">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_1" value="default" checked="checked">
<label class="form-check-label" for="sidebar_bg_1"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_2" value="color_2">
<label class="form-check-label" for="sidebar_bg_2"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_3" value="color_3">
<label class="form-check-label" for="sidebar_bg_3"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_4" value="color_4">
<label class="form-check-label" for="sidebar_bg_4"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_5" value="color_5">
<label class="form-check-label" for="sidebar_bg_5"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_6" value="color_6">
<label class="form-check-label" for="sidebar_bg_6"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_7" value="color_7">
<label class="form-check-label" for="sidebar_bg_7"></label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="sidebar_bg" id="sidebar_bg_8" value="color_8">
<label class="form-check-label" for="sidebar_bg_8"></label>
</div>
</li>
</ul>
</li>
<!--End 切换主题配色-->
<!--个人头像内容-->
<li class="dropdown">
<a href="javascript:void(0)" data-bs-toggle="dropdown" class="dropdown-toggle">
<img class="avatar-md rounded-circle" src="images/users/avatar.jpg" alt="笔下光年" />
<span style="margin-left: 10px;">笔下光年</span>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<a class="dropdown-item" href="lyear_pages_profile.html"
href="javascript:void(0)">
<i class="mdi mdi-account"></i>
<span>个人信息</span>
</a>
</li>
<li>
<a class="dropdown-item" href="lyear_pages_edit_pwd.html"
href="javascript:void(0)">
<i class="mdi mdi-lock-outline"></i>
<span>修改密码</span>
</a>
</li>
<li>
<a class="dropdown-item" href="javascript:void(0)">
<i class="mdi mdi-delete"></i>
<span>清空缓存</span>
</a>
</li>
<li class="dropdown-divider"></li>
<li>
<a class="dropdown-item" href="lyear_pages_login_1.html">
<i class="mdi mdi-logout-variant"></i>
<span>退出登录</span>
</a>
</li>
</ul>
</li>
<!--End 个人头像内容-->
</ul>
</nav>
</header>
<!--End 头部信息-->
<!--页面主要内容-->
<main class="lyear-layout-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<header class="card-header"><div class="card-title">模态框</div></header>
<div class="card-body">
<p>使用 Bootstrap 的 JavaScript 模态插件向您的站点添加对话框,用于灯箱、用户通知或完全自定义的内容。</p>
<h5>它是怎样工作的</h5>
<p>在开始使用 Bootstrap 的模态组件之前,请务必阅读以下内容,因为我们的菜单选项最近发生了变化。</p>
<ul>
<li>模态框是用 HTML、CSS 和 JavaScript 构建的。 它们被定位在文档中的所有其他内容之上,并从 <code>&lt;body&gt;</code> 中移除滚动,以便模态框内容滚动。</li>
<li>点击模态 “背景” 将自动关闭模态框。</li>
<li>Bootstrap 一次只支持一个模态窗口。不支持嵌套模式,因为我们认为它们是糟糕的用户体验。</li>
<li>模态框使用 <code>position:fixed</code>,它的渲染有时会有些特殊。只要有可能,将您的模态 HTML 放在顶级位置,以避免来自其他元素的潜在干扰。 将 <code>.modal</code> 嵌套在另一个固定元素中时,您可能会遇到问题。</li>
<li>再一次,由于 <code>position:fixed</code>,在移动设备上使用模态框有一些注意事项。</li>
<li>由于 HTML5 如何定义其语义,<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autofocus" target="_blank"><code>autofocus</code > HTML 属性</a> 在 Bootstrap 模式中无效。要达到相同的效果,请使用一些自定义 JavaScript:</li>
</ul>
<pre>var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')
myModal.addEventListener('shown.bs.modal', function () {
myInput.focus()
})</pre>
<div class="callout callout-info mb-3">该组件的动画效果依赖于 <code>prefers-reduced-motion</code> 媒体查询。</div>
<p>继续阅读演示和使用指南。</p>
<h5>示例</h5>
<h6>模态组件</h6>
<p>下面是一个 <em>static</em> 模态示例(意味着它的 <code>position</code><code>display</code> 已被覆盖)。 包括模态标题、模态正文(<code>padding</code> 必需)和模态页脚(可选)。 我们要求您尽可能在模式标题中包含解除操作,或提供另一个明确的解除操作。</p>
<div class="border-example border-example-modal">
<div class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title">标题</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>祷罢,试卜一爻,暗视道:“我李靖若有天子之分,乞即赐一圣爻。”将爻掷下。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
</div>
<pre>&lt;div class="modal" tabindex="-1"&gt;
&lt;div class="modal-dialog"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title"&gt;标题&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;祷罢,试卜一爻,暗视道:“我李靖若有天子之分,乞即赐一圣爻。”将爻掷下。&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
&lt;button type="button" class="btn btn-primary"&gt;保存修改&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<h6>现场示例</h6>
<p>通过单击下面的按钮来切换工作模式演示。它将向下滑动并从页面顶部淡入。</p>
<div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLiveLabel">二心集</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>杂文集,收录了鲁迅在1930年-1931年间所写的杂文三十七篇。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLive">
启动演示模态框
</button>
</div>
<pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLive"&gt;
启动演示模态框
&lt;/button&gt;
&lt;div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true"&gt;
&lt;div class="modal-dialog"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title" id="exampleModalLiveLabel"&gt;二心集&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;杂文集,收录了鲁迅在1930年-1931年间所写的杂文三十七篇。&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
&lt;button type="button" class="btn btn-primary"&gt;保存修改&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<h6>静态背景</h6>
<p>当背景设置为静态时,在其外部单击时模态将不会关闭。单击下面的按钮进行尝试。</p>
<div class="modal fade" id="staticBackdropLive" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="staticBackdropLiveLabel">东游记</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>又名《上洞八仙传》、《八仙出处东游记》,共二卷五十六回。记叙铁拐李、汉钟离、吕洞宾、张果老、蓝采和、何仙姑、韩湘子、曹国舅八位神仙修炼得道的过程。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">明白了</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdropLive">
启动静态背景模态框
</button>
</div>
<pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdropLive"&gt;
启动静态背景模态框
&lt;/button&gt;
&lt;div class="modal fade" id="staticBackdropLive" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true"&gt;
&lt;div class="modal-dialog"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title" id="staticBackdropLiveLabel"&gt;东游记&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;p&gt;又名《上洞八仙传》、《八仙出处东游记》,共二卷五十六回。记叙铁拐李、汉钟离、吕洞宾、张果老、蓝采和、何仙姑、韩湘子、曹国舅八位神仙修炼得道的过程。&lt;/p&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
&lt;button type="button" class="btn btn-primary"&gt;明白了&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<h6>滚动长内容</h6>
<p>当模态框对于用户的视口或设备而言变得太长时,它们会独立于页面本身滚动。试试下面的演示,看看我们的意思。</p>
<div class="modal fade" id="exampleModalLong" tabindex="-1" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLongTitle">乐府古题要解</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" style="min-height: 1500px">
<p>音乐著作。分上下二卷。采录史传与诸家文集有关乐府古题命名缘起的记载纂辑成书材料丰富考证翔实。对研究汉魏六朝音乐有一定的参考价值。但卷末附载“建除体”及“字谜”等都与乐府无关。有明毛晋汲古阁据元刻所刊《学津讨原》本。《乐府古题要解》书前有小序,说明了作者撰述此书的目的,是要扫除乐府诗创作中“不睹于本章,便断题取义”的积弊,为后人“取正”提供依据。书中罗列汉魏六朝乐府古题一百余个,分别阐发其最初的主旨、涵义,有的还引录古词,考证本事,叙述流变,内容较为详实。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example mb-3">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLong">
启动演示模态框
</button>
</div>
<p>您还可以通过将 <code>.modal-dialog-scrollable</code> 添加到 <code>.modal-dialog</code> 来创建允许滚动模态体的可滚动模态。</p>
<div class="modal fade" id="exampleModalScrollable" tabindex="-1" aria-labelledby="exampleModalScrollableTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalScrollableTitle">二十四尊得道罗汉传</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>《二十四尊得道罗汉传》是明代朱星祚编写的一部书籍,万历间刊本,日本内阁文库藏。孙楷第《中国通俗小说书目》、《日本东京所见小说书目》均有著录。谭正壁等著《古本稀见小说汇考》第五十六条《二十四尊得道罗汉传》所述,则系综合翻录孙楷第所著书目中文。《罗汉传》是一部稀见小说。</p>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>滚动后,此内容应显示在底部。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalScrollable">
启动演示模态框
</button>
</div>
<pre>&lt;!-- 可滚动模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-scrollable"&gt;
...
&lt;/div&gt;</pre>
<h6>垂直居中</h6>
<p><code>.modal-dialog-centered</code> 添加到 <code>.modal-dialog</code> 以使模态框垂直居中。</p>
<div class="modal fade" id="exampleModalCenter" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalCenterTitle">于公案</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>评书传统书目,长篇,编创于清末。石玉昆纂弄的《三侠五义》(《包公案》)问世以后,北京一些有编创能力的评书艺人纷起效仿,纂弄新书,《于公案》就是其中影响较大的一种。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalCenteredScrollable" tabindex="-1" aria-labelledby="exampleModalCenteredScrollableTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalCenteredScrollableTitle">五代秘史</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>五代日事干戈,胡虏交驰,乱贼横行,中原始无宁宇,幸宋太祖一统中华,其亦世道之幸欤!一段不为人知的历史!</p>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>就这样。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalCenter">
垂直居中的模态框
</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalCenteredScrollable">
垂直居中的可滚动模态框
</button>
</div>
<pre>&lt;!-- 垂直居中的模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-centered"&gt;
...
&lt;/div&gt;
&lt;!-- 垂直居中的可滚动模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"&gt;
...
&lt;/div&gt;</pre>
<h6>工具提示和弹出框</h6>
<p>工具提示和弹出框可以根据需要放置在模态框中。当模态框关闭时,其中的任何工具提示和弹出框也会自动关闭。</p>
<div class="modal fade" id="exampleModalPopovers" tabindex="-1" aria-labelledby="exampleModalPopoversLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalPopoversLabel">五虎征西</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h5>模态框中的Popover</h5>
<p><a href="#" role="button" class="btn btn-secondary" title="万花楼演义" data-bs-content="又名《万花楼杨包狄演义》,十四卷六十八回。" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right">《万花楼演义》</a> 同脉络,但情节内容自成首尾,叙述宋仁宗命狄青等五虎将征西的故事。</p>
<hr>
<h5>模态框中的Tooltips</h5>
<p>作者依照时代的人心需要,创造了<a href="#" title="字汉臣,北宋名将" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top">狄青</a><a href="#" title="字希仁,北宋名臣" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top">包公</a> 等符合人们愿望的人物,托名历史而演述出一系列故事。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalPopovers">
启动演示模态框
</button>
</div>
<pre>&lt;div class="modal-body"&gt;
&lt;h5&gt;模态框中的Popover&lt;/h5&gt;
&lt;p&gt;&lt;a href="#" role="button" class="btn btn-secondary" title="万花楼演义" data-bs-content="又名《万花楼杨包狄演义》,十四卷六十八回。" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right"&gt;《万花楼演义》&lt;/a&gt;同脉络,但情节内容自成首尾,叙述宋仁宗命狄青等五虎将征西的故事。&lt;/p&gt;
&lt;hr&gt;
&lt;h5&gt;模态框中的Tooltips&lt;/h5&gt;
&lt;p&gt;作者依照时代的人心需要,创造了&lt;a href="#" title="字汉臣,北宋名将" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top"&gt;狄青&lt;/a&gt;&lt;a href="#" title="字希仁,北宋名臣" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top"&gt;包公&lt;/a&gt;等符合人们愿望的人物,托名历史而演述出一系列故事。&lt;/p&gt;
&lt;/div&gt;</pre>
<h6>使用网格</h6>
<p>通过将 <code>.container-fluid</code> 嵌套在 <code>.modal-body</code> 中,在 modal 中使用 Bootstrap 网格系统。然后,像在其他任何地方一样使用普通的网格系统类。</p>
<div class="modal fade" id="gridSystemModal" tabindex="-1" aria-labelledby="gridModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="gridModalLabel">模态框中的网格</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="container-fluid bd-example-row">
<div class="row">
<div class="col-md-4">.col-md-4</div>
<div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
</div>
<div class="row">
<div class="col-md-3 ms-auto">.col-md-3 .ms-auto</div>
<div class="col-md-2 ms-auto">.col-md-2 .ms-auto</div>
</div>
<div class="row">
<div class="col-md-6 ms-auto">.col-md-6 .ms-auto</div>
</div>
<div class="row">
<div class="col-sm-9">
Level 1: .col-sm-9
<div class="row">
<div class="col-8 col-sm-6">
Level 2: .col-8 .col-sm-6
</div>
<div class="col-4 col-sm-6">
Level 2: .col-4 .col-sm-6
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存修改</button>
</div>
</div>
</div>
</div>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#gridSystemModal">
启动演示模态框
</button>
</div>
<pre>&lt;div class="modal-body"&gt;
&lt;div class="container-fluid bd-example-row"&gt;
&lt;div class="row"&gt;
&lt;div class="col-md-4"&gt;.col-md-4&lt;/div&gt;
&lt;div class="col-md-4 ms-auto"&gt;.col-md-4 .ms-auto&lt;/div&gt;
&lt;/div&gt;
&lt;div class="row"&gt;
&lt;div class="col-md-3 ms-auto"&gt;.col-md-3 .ms-auto&lt;/div&gt;
&lt;div class="col-md-2 ms-auto"&gt;.col-md-2 .ms-auto&lt;/div&gt;
&lt;/div&gt;
&lt;div class="row"&gt;
&lt;div class="col-md-6 ms-auto"&gt;.col-md-6 .ms-auto&lt;/div&gt;
&lt;/div&gt;
&lt;div class="row"&gt;
&lt;div class="col-sm-9"&gt;
Level 1: .col-sm-9
&lt;div class="row"&gt;
&lt;div class="col-8 col-sm-6"&gt;
Level 2: .col-8 .col-sm-6
&lt;/div&gt;
&lt;div class="col-4 col-sm-6"&gt;
Level 2: .col-4 .col-sm-6
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<h6>改变模态框内容</h6>
<p>有一堆按钮都触发相同的模式,内容略有不同?使用 <code>event.relatedTarget</code><a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes" target="_blank">HTML <code >data-bs-*</code> 属性</a> 以根据单击的按钮来改变模式的内容。</p>
<p>下面是一个现场演示,后面是示例 HTML 和 JavaScript。如需更多信息,请阅读模态事框件文档以了解有关 <code>relatedTarget</code> 的详细信息。</p>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo">打开模态 @mdo</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat">打开模态框 @fat</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap">打开模态框 @getbootstrap</button>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLabel">新消息</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">收件人:</label>
<input type="text" class="form-control" id="recipient-name">
</div>
<div class="mb-3">
<label for="message-text" class="col-form-label">消息:</label>
<textarea class="form-control" id="message-text"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">发送消息</button>
</div>
</div>
</div>
</div>
</div>
<pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo"&gt;打开模态 @mdo&lt;/button&gt;
&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat"&gt;打开模态框 @fat&lt;/button&gt;
&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap"&gt;打开模态框 @getbootstrap&lt;/button&gt;
&lt;div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"&gt;
&lt;div class="modal-dialog"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title" id="exampleModalLabel"&gt;新消息&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
&lt;form&gt;
&lt;div class="mb-3"&gt;
&lt;label for="recipient-name" class="col-form-label"&gt;收件人:&lt;/label&gt;
&lt;input type="text" class="form-control" id="recipient-name"&gt;
&lt;/div&gt;
&lt;div class="mb-3"&gt;
&lt;label for="message-text" class="col-form-label"&gt;消息:&lt;/label&gt;
&lt;textarea class="form-control" id="message-text"&gt;&lt;/textarea&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
&lt;button type="button" class="btn btn-primary"&gt;发送消息&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</pre>
<pre>var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
// Button that triggered the modal
var button = event.relatedTarget
// Extract info from data-bs-* attributes
var recipient = button.getAttribute('data-bs-whatever')
// If necessary, you could initiate an AJAX request here
// and then do the updating in a callback.
//
// Update the modal's content.
var modalTitle = exampleModal.querySelector('.modal-title')
var modalBodyInput = exampleModal.querySelector('.modal-body input')
modalTitle.textContent = '给 ' + recipient + '的新消息'
modalBodyInput.value = recipient
})</pre>
<h6>在模态框之间切换</h6>
<p>通过巧妙地放置 <code>data-bs-target</code><code>data-bs-toggle</code> 属性在多个模式之间切换。例如,您可以在已打开的登录模式中切换密码重置模式。<strong>请注意,不能同时打开多个模态框</strong>——此方法只是在两个单独的模态框之间切换。</p>
<div class="bd-example">
<div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalToggleLabel">模态框 1</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
显示第二个模态并使用下面的按钮隐藏这个。
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal">打开第二个模态框</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalToggleLabel2">模态框 2</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
隐藏此模式并使用下面的按钮显示第一个。
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal">返回第一个模态框</button>
</div>
</div>
</div>
</div>
<a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button">打开第一个模态框</a>
</div>
<pre>&lt;div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1"&gt;
&lt;div class="modal-dialog modal-dialog-centered"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title" id="exampleModalToggleLabel"&gt;模态框 1&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
显示第二个模态并使用下面的按钮隐藏这个。
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal"&gt;打开第二个模态框&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1"&gt;
&lt;div class="modal-dialog modal-dialog-centered"&gt;
&lt;div class="modal-content"&gt;
&lt;div class="modal-header"&gt;
&lt;h6 class="modal-title" id="exampleModalToggleLabel2"&gt;模态框 2&lt;/h6&gt;
&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
&lt;/div&gt;
&lt;div class="modal-body"&gt;
隐藏此模式并使用下面的按钮显示第一个。
&lt;/div&gt;
&lt;div class="modal-footer"&gt;
&lt;button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal"&gt;返回第一个模态框&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button"&gt;打开第一个模态框&lt;/a&gt;</pre>
<h6>更改动画</h6>
<p><code>$modal-fade-transform</code> 变量决定了 <code>.modal-dialog</code> 在模态淡入动画之前的变换状态,<code>$modal-show-transform</code> 变量决定了 <code>.modal-dialog</code> 在模态淡入动画结束时的变换。</p>
<p>例如,如果你想要一个放大动画,你可以设置 <code>$modal-fade-transform: scale(.8)</code></p>
<h6>移除动画</h6>
<p>对于只是出现而不是淡入查看的模态,请从模态标记中删除 <code>.fade</code> 类。</p>
<pre>&lt;div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true"&gt;
...
&lt;/div&gt;</pre>
<h6>动态高度</h6>
<p>如果模态框在打开时高度发生变化,您应该调用 <code>myModal.handle Update()</code> 来调整模态框的位置,以防出现滚动条。</p>
<h6>可访问性</h6>
<p>请务必将引用模态标题的 <code>aria-labelledby="..."</code> 添加到 <code>.modal</code>。 此外,您可以在 <code>.modal</code> 上使用 <code>aria- describeby</code> 来描述您的模态对话框。 请注意,您不需要添加 <code>role="dialog"</code>,因为我们已经通过 JavaScript 添加了它。</p>
<h6>嵌入 YouTube 视频</h6>
<p>在模态中嵌入 YouTube 视频需要额外的 JavaScript,而不是 Bootstrap 来自动停止播放等等。 <a href="https://stackoverflow.com/questions/18622508/bootstrap-3-and-youtube-in-modal" target="_blank">查看这篇有用的 Stack Overflow 帖子</a>了解更多信息。</p>
<h5>可选尺寸</h5>
<p>模态框有三种可选尺寸,可通过修饰符类放置在 <code>.modal-dialog</code> 上。 这些尺寸在某些断点处开始,以避免在较窄的视口上出现水平滚动条。</p>
<table class="table">
<thead>
<tr>
<th>尺寸</th>
<th>Class</th>
<th>模态框最大宽度</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td><code>.modal-sm</code></td>
<td><code>300px</code></td>
</tr>
<tr>
<td>默认</td>
<td class="text-muted">None</td>
<td><code>500px</code></td>
</tr>
<tr>
<td></td>
<td><code>.modal-lg</code></td>
<td><code>800px</code></td>
</tr>
<tr>
<td>特大</td>
<td><code>.modal-xl</code></td>
<td><code>1140px</code></td>
</tr>
</tbody>
</table>
<p>我们没有修饰符类的默认模态构成了 &ldquo;medium&rdquo; 大小模态。</p>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalXl">超大模态框</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLg">大模态框</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalSm">小模态框</button>
</div>
<div class="modal fade" id="exampleModalXl" tabindex="-1" aria-labelledby="exampleModalXlLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalXlLabel">超大模态框</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalLg" tabindex="-1" aria-labelledby="exampleModalLgLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalLgLabel">大模态框</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalSm" tabindex="-1" aria-labelledby="exampleModalSmLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalSmLabel">小模态框</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
<pre>&lt;div class="modal-dialog modal-xl"&gt;...&lt;/div&gt;
&lt;div class="modal-dialog modal-lg"&gt;...&lt;/div&gt;
&lt;div class="modal-dialog modal-sm"&gt;...&lt;/div&gt;</pre>
<h5>全屏模式</h5>
<p>另一个覆盖是弹出覆盖用户视口的模式的选项,可通过放置在 <code>.modal-dialog</code> 上的修饰符类获得。</p>
<table class="table">
<thead>
<tr>
<th>Class</th>
<th>可用性</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>.modal-fullscreen</code></td>
<td>一直</td>
</tr>
<tr>
<td><code>.modal-fullscreen-sm-down</code></td>
<td><code>576px</code> 以下</td>
</tr>
<tr>
<td><code>.modal-fullscreen-md-down</code></td>
<td><code>768px</code> 以下</td>
</tr>
<tr>
<td><code>.modal-fullscreen-lg-down</code></td>
<td><code>992px</code> 以下</td>
</tr>
<tr>
<td><code>.modal-fullscreen-xl-down</code></td>
<td><code>1200px</code> 以下</td>
</tr>
<tr>
<td><code>.modal-fullscreen-xxl-down</code></td>
<td><code>1400px</code> 以下</td>
</tr>
</tbody>
</table>
<div class="border-example">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreen">全屏</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenSm">sm以下全屏</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenMd">md以下全屏</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenLg">lg以下全屏</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenXl">xl以下全屏</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenXxl">xxl以下全屏</button>
</div>
<pre>&lt;!-- 全屏模态框 --&gt;
&lt;div class="modal-dialog modal-fullscreen-sm-down"&gt;
...
&lt;/div&gt;</pre>
<div class="modal fade" id="exampleModalFullscreen" tabindex="-1" aria-labelledby="exampleModalFullscreenLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenLabel">全屏模态框</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalFullscreenSm" tabindex="-1" aria-labelledby="exampleModalFullscreenSmLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-sm-down">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenSmLabel">sm以下全屏</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalFullscreenMd" tabindex="-1" aria-labelledby="exampleModalFullscreenMdLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-md-down">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenMdLabel">md以下全屏</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalFullscreenLg" tabindex="-1" aria-labelledby="exampleModalFullscreenLgLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenLgLabel">lg以下全屏</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalFullscreenXl" tabindex="-1" aria-labelledby="exampleModalFullscreenXlLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-xl-down">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenXlLabel">xl以下全屏</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModalFullscreenXxl" tabindex="-1" aria-labelledby="exampleModalFullscreenXxlLabel" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-xxl-down">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="exampleModalFullscreenXxlLabel">xxl以下全屏</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<h5>用法</h5>
<p>模态插件通过数据属性或 JavaScript 按需切换隐藏内容。 它还覆盖默认滚动行为并生成一个 <code>.modal-backdrop</code> 以提供一个单击区域,以便在单击模态框外时关闭显示的模态框。</p>
<h6>通过数据属性</h6>
<strong>Toggle</strong>
<p>无需编写 JavaScript 即可激活模式。 在控制器元素(如按钮)上设置 <code>data-bs-toggle="modal"</code> 以及 <code>data-bs-target="#foo"</code>< code>href=&quot;#foo&quot;</code> 以指定要切换的模式。</p>
<pre>&lt;button type="button" data-bs-toggle="modal" data-bs-target="#myModal"&gt;Launch modal&lt;/button&gt;</pre>
<strong>Dismiss</strong>
<p>可以通过 <strong>模态</strong> 按钮上的 <code>data</code> 属性实现解除,如下所示:</p>
<pre>&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;</pre>
<p>或使用 <code>data-bs-target</code><strong>模态框外</strong> 的按钮上,如下所示:</p>
<pre>&lt;button type="button" class="btn-close" data-bs-dismiss="modal" data-bs-target="#my-modal" aria-label="Close"&gt;&lt;/button&gt;</pre>
<div class="callout callout-warning mb-3">虽然支持解除模态的两种方式,但请记住,从模态外部解除与 <a href="https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal" target="_blank">WAI-ARIA 模式对话框设计模式</a>。这样做需要您自担风险。</div>
<h6>通过 JavaScript</h6>
<p>用一行 JavaScript 创建一个模态框:</p>
<pre>var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)</pre>
<h6>选项</h6>
<p>选项可以通过数据属性或 JavaScript 传递。 对于数据属性,将选项名称附加到 <code>data-bs-</code>,如 <code>data-bs-backdrop=""</code></p>
<table class="table">
<thead>
<tr>
<th style="width: 100px;">姓名</th>
<th style="width: 50px;">类型</th>
<th style="width: 50px;">默认</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>backdrop</code></td>
<td>boolean or the string <code>'static'</code></td>
<td><code>true</code></td>
<td>包括一个模态背景元素。 或者,为在单击时不关闭模式的背景指定 <code>static</code></td>
</tr>
<tr>
<td><code>keyboard</code></td>
<td>boolean</td>
<td><code>true</code></td>
<td>按下退出键时关闭模态</td>
</tr>
<tr>
<td><code>focus</code></td>
<td>boolean</td>
<td><code>true</code></td>
<td>初始化时将焦点放在模式上。</td>
</tr>
</tbody>
</table>
<h6>方法</h6>
<div class="callout callout-danger mb-3">
<strong>异步方法和转换</strong>
<p>所有 API 方法都是<strong>异步</strong>并启动<strong>transition</strong>。 它们会在过渡开始后但<strong>在过渡结束之前</strong>返回给调用者。 此外,<strong>转换组件上的方法调用将被忽略</strong></p>
</div>
<strong>传递选项</strong>
<p>将您的内容激活为模式。 接受可选选项<code>object</code></p>
<pre>var myModal = new bootstrap.Modal(document.getElementById('myModal'), {
keyboard: false
})</pre>
<strong>toggle</strong>
<p>手动切换模式。 <strong>在模态框实际显示或隐藏之前返回调用者</strong>(即在 <code>shown.bs.modal</code><code>hidden.bs.modal</code> 事件之前 发生)。</p>
<pre>myModal.toggle()</pre>
<strong>show</strong>
<p>手动打开一个模态框。 <strong>在模态框实际显示之前返回调用者</strong>(即在 <code>shown.bs.modal</code> 事件发生之前)。</p>
<pre>myModal.show()</pre>
<p>此外,您可以将 DOM 元素作为可在模式事件中接收的参数传递(作为 <code>relatedTarget</code> 属性)。</p>
<pre>var modalToggle = document.getElementById('toggleMyModal') // relatedTarget
myModal.show(modalToggle)</pre>
<strong>hide</strong>
<p>手动隐藏模态框。 <strong>在模态框实际隐藏之前返回调用者</strong>(即在 <code>hidden.bs.modal</code> 事件发生之前)。</p>
<pre>myModal.hide()</pre>
<strong>handleUpdate</strong>
<p>如果模态框在打开时的高度发生变化(即出现滚动条时),请手动重新调整模态框的位置。</p>
<pre>myModal.handleUpdate()</pre>
<strong>dispose</strong>
<p>销毁元素的模态。(删除 DOM 元素上存储的数据)</p>
<pre>myModal.dispose()</pre>
<strong>getInstance</strong>
<p><em>Static</em> 方法,允许您获取与 DOM 元素关联的模态实例。</p>
<pre>var myModalEl = document.getElementById('myModal')
var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance</pre>
<strong>getOrCreateInstance</strong>
<p><em>Static</em> 方法,该方法允许您获取与 DOM 元素关联的模式实例,或者在未初始化的情况下创建一个新实例。</p>
<pre>var myModalEl = document.querySelector('#myModal')
var modal = bootstrap.Modal.getOrCreateInstance(myModalEl) // Returns a Bootstrap modal instance</pre>
<h6>事件</h6>
<p>Bootstrap 的模态类公开了一些用于连接模态功能的事件。 所有模态事件都在模态本身触发(即在 <code>&lt;div class="modal"&gt;</code> 处)。</p>
<table class="table">
<thead>
<tr>
<th style="width: 150px;">事件类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>show.bs.modal</code></td>
<td>此事件在调用 <code>show</code> 实例方法时立即触发。 如果由单击引起,则单击的元素可用作事件的 <code>relatedTarget</code> 属性。</td>
</tr>
<tr>
<td><code>shown.bs.modal</code></td>
<td>当模式对用户可见时触发此事件(将等待 CSS 转换完成)。 如果由单击引起,则单击的元素可用作事件的 <code>relatedTarget</code> 属性。</td>
</tr>
<tr>
<td><code>hide.bs.modal</code></td>
<td>当调用 <code>hide</code> 实例方法时,会立即触发此事件。</td>
</tr>
<tr>
<td><code>hidden.bs.modal</code></td>
<td>当模态对用户隐藏完成时会触发此事件(将等待 CSS 转换完成)。</td>
</tr>
<tr>
<td><code>hidePrevented.bs.modal</code></td>
<td>当显示模式时触发此事件,其背景为 <code>static</code> 并且使用键盘选项或 <code>data-bs-keyboard</code> 执行模式外的单击或退出键按下设置为 <code>false</code></td>
</tr>
</tbody>
</table>
<pre>var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', function (event) {
// do something...
})</pre>
</div>
</div>
</div>
</div>
</div>
</main>
<!--End 页面主要内容-->
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript">
/* 演示示例的一些代码 */
var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
var button = event.relatedTarget
var recipient = button.getAttribute('data-bs-whatever')
var modalTitle = exampleModal.querySelector('.modal-title')
var modalBodyInput = exampleModal.querySelector('.modal-body input')
modalTitle.textContent = '' + recipient + '的新消息'
modalBodyInput.value = recipient
})
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/yinqi/Light-Year-Admin-Template-v5.git
git@gitee.com:yinqi/Light-Year-Admin-Template-v5.git
yinqi
Light-Year-Admin-Template-v5
Light Year Admin v5
master

搜索帮助