Bootstrap 模態(tài)框(Modal)插件代碼解析
Bootstrap 模態(tài)框(Modal)插件 模態(tài)框(Modal)是覆蓋在父窗體上的子窗體。通常,目的是顯示來自一個(gè)單獨(dú)的源的內(nèi)容,可以在不離開父窗體的情況下有一些互動(dòng)。子窗體可提供信息、交互等。下面通過代碼給大家介紹bootstrap 模態(tài)框插件,先給大家展示下效果圖:
頁面效果:
html+js:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>my love-用戶登錄</title> <link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/login.css"> <link rel="stylesheet" href="css/register.css"> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/modal.js" type="text/javascript"></script> </head> <body> <div class="main"> <form class="form-horizontal" action="index.html"> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">用戶名:</label> <div class="col-xs-7 col-md-7"> <input type="text" class="form-control input-user-name" placeholder="請(qǐng)輸入用戶名......"> </div> </div> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">密 碼:</label> <div class="col-xs-7 col-md-7"> <input type="password" class="form-control password-user-name" placeholder="請(qǐng)輸入密碼......"> </div> </div> <div class="form-group bottom-button"> <div class="col-xs-offset-4 col-xs-3 col-md-3"> <button type="button" class="btn btn-success login-success-button">登錄</button> </div> <div class="col-xs-3 col-md-3"> <!-- Button register-modal --> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#register-modal">注冊(cè)</button> </div> </div> </form> <!-- Modal --> <div class="modal fade" id="register-modal" tabindex="-1" role="dialog" aria-labelledby="register-modal-label"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="register-modal-label">新用戶注冊(cè):</h4> </div> <div class="modal-body"> <div class="form-horizontal"> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">郵 箱:</label> <div class="col-xs-7 col-md-7"> <input type="text" class="form-control"> </div> </div> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">用戶名:</label> <div class="col-xs-7 col-md-7"> <input type="text" class="form-control"> </div> </div> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">密 碼:</label> <div class="col-xs-7 col-md-7"> <input type="password" class="form-control"> </div> </div> <div class="form-group"> <label class="col-xs-3 col-md-3 control-label no-padding-right">確認(rèn)密碼:</label> <div class="col-xs-7 col-md-7"> <input type="password" class="form-control"> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-info register-button">注冊(cè)</button> <button type="button" class="btn btn-default" data-dismiss="modal">返回</button> </div> </div> </div> </div> </div> <script type="text/javascript"> $(function() { $('.register-button').click(function() { document.location.href = "login.html"; }); }); </script> </body> </html>
login.css
body { background: url(../image/sun.jpg) no-repeat; -moz-background-size: 100% 100%; -webkit-background-size: 100% 100%; } .main { width: 365px; height: 200px; margin: 230px auto; /*border: 2px solid #3a9c08;*/ } .form-horizontal { padding-top: 30px } .main>.form-horizontal>.form-group>.col-xs-3.col-md-3.control-label.no-padding-right { color: #fff; } label.control-label.no-padding-right { padding-right: 0; font-size: 17px; } .form-horizontal .form-group { margin-right: 0; margin-left: 0; } .form-group.bottom-button { padding-top: 10px; }
register.css
.modal-dialog .modal-content .modal-header { background: url(../image/registerTop.png) no-repeat; -moz-background-size: 100% 100%; -webkit-background-size: 100% 100%; } .modal-dialog .modal-content .modal-footer { background-color: #d5feff; }
以上所述是小編給大家介紹的Bootstrap 模態(tài)框(Modal)插件代碼解析,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
jQuery.extend()的實(shí)現(xiàn)方式詳解及實(shí)例
extend()函數(shù)是jQuery的基礎(chǔ)函數(shù)之一,作用是擴(kuò)展現(xiàn)有的對(duì)象2013-06-06BootStrap Fileinput初始化時(shí)的一些參數(shù)
本文通過一個(gè)例子給大家簡(jiǎn)單介紹了bootstrap fileinput初始化時(shí)的一些參數(shù),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下2016-12-12{}與function(){}選用空對(duì)象{}來存放keyValue
雖說js里面什么都能當(dāng)對(duì)象,也能用填鴨式方法任意給對(duì)象添加屬性,屬性賦值.但是有些js內(nèi)置的對(duì)象,類型屬性也是沒辦法覆蓋的2012-05-05感覺很流暢的js實(shí)現(xiàn)的鍵盤控制(帶慣性)
感覺很流暢的js實(shí)現(xiàn)的鍵盤控制(帶慣性)...2007-06-06js動(dòng)態(tài)添加表格數(shù)據(jù)使用insertRow和insertCell實(shí)現(xiàn)
這篇文章主要介紹了js動(dòng)態(tài)添加表格數(shù)據(jù)并使用insertRow和insertCell實(shí)現(xiàn),需要的朋友可以參考下2014-05-05js獲取input標(biāo)簽的輸入值實(shí)現(xiàn)代碼
input標(biāo)簽的輸入值通過js進(jìn)行獲取,部分標(biāo)簽和類是封裝在框架內(nèi)的,其效果和html標(biāo)簽差不多,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下,希望對(duì)大家有所幫助2013-08-08Highcharts使用簡(jiǎn)例及異步動(dòng)態(tài)讀取數(shù)據(jù)
Highcharts 是一個(gè)用純JavaScript編寫的一個(gè)圖表庫, 能夠很簡(jiǎn)單便捷的在web網(wǎng)站或是web應(yīng)用程序添加有交互性的圖表,并且免費(fèi)提供給個(gè)人學(xué)習(xí)、個(gè)人網(wǎng)站和非商業(yè)用途使用,通過本文給大家介紹Highcharts使用簡(jiǎn)例及異步動(dòng)態(tài)讀取數(shù)據(jù)的相關(guān)知識(shí),感興趣的朋友一起學(xué)習(xí)吧2015-12-12手把手教會(huì)你用Javascript實(shí)現(xiàn)放大鏡效果(詳細(xì)注釋+完整代碼)
放大鏡可以說是前端人必須學(xué)會(huì)的程序之一,下面這篇文章主要給大家介紹了關(guān)于手把手教會(huì)你用Javascript實(shí)現(xiàn)放大鏡效果的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-03-03