jquery+CSS實(shí)現(xiàn)懸浮登錄框遮罩
本文實(shí)例為大家分享了jquery+CSS實(shí)現(xiàn)懸浮登錄框遮罩的具體代碼,供大家參考,具體內(nèi)容如下
先上效果圖,陰影部分無法點(diǎn)擊

HTML代碼
<div style="display: none" class="shadow" id="shadow"></div> <div style="display: none" id="login-box" class="login-box"> ? ? <div class="close-btn"> ? ? ? ? <img src="./img/close.jpg" width="30" height="30" id="close-login-btn" alt=""> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <label for="username">用戶名</label> ? ? ? ? <input type="text" name="username" id="username" placeholder="用戶名/郵箱/手機(jī)號碼"> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <label for="password">密 碼</label> ? ? ? ? <input type="password" name="password" id="password" placeholder="密碼"> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <label for="check-code">驗(yàn)證碼</label> ? ? ? ? <input type="text" name="check-code" id="check-code" placeholder="驗(yàn)證碼"> ? ? ? ? <!--<button type="button" id="get-check-code"> </button>--> ? ? ? ? <div id="req_pic_code" > ? ? ? ? ? ? <img src="" id="get-check-code" alt=""> ? ? ? ? </div> ? ? ? ? <!--<img src="" id="get-check-code" alt="">--> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <button type="button" id="login-btn">登 錄</button> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <img src="./pic/QQ.jpg" width="50" height="50" alt=""> ? ? ? ? <img src="./pic/微信.jpg" width="50" height="50" alt=""> ? ? ? ? <img src="./pic/微博.jpg" width="50" height="50" alt=""> ? ? </div> ? ? <div class="input-item"> ? ? ? ? <!--登錄即代表你同意 《用戶協(xié)議》, 《隱私政策》和 中移動認(rèn)證服務(wù)協(xié)議--> ? ? ? ? <span>登錄即代表你同意</span> ? ? ? ? <a href="#">《用戶協(xié)議》</a> ? ? ? ? <span>,</span> ? ? ? ? <a href="#">《隱私政策》</a> ? ? ? ? <span>和</span> ? ? ? ? <a href="#">中移動認(rèn)證服務(wù)協(xié)議</a> ? ? </div> </div>
css代碼
/* 半透明的遮罩層 */
.shadow {
? ? background: #000;
? ? filter: alpha(opacity=70); /* IE的透明度 */
? ? opacity: 0.5; /* 透明度 */
? ? display: none;
? ? position: absolute;
? ? top: 0;
? ? left: 0;
? ? width: 100%;
? ? height: 100%;
? ? z-index: 965; /* 此處的圖層要大于頁面 */
}
.login-box {
? ? text-align: center;
? ? width: 500px;
? ? height: 350px;
? ? border-radius: 10px;
? ? /*border: 3px solid gainsboro;*/
? ? position: absolute;
? ? left: 50%;
? ? top: 50%;
? ? transform: translate(-50%, -50%);
? ? background: #ffe3e1;
? ? -webkit-box-shadow: #666 0 0 6px;
? ? -moz-box-shadow: #666 0 0 6px;
? ? box-shadow: #fff8e7 0 0 6px 6px;
? ? z-index: 996; ?/* 此處的圖層要大于遮罩圖層 */
}jQuery代碼
//登錄,點(diǎn)擊登錄顯示登錄框
$("#login-link").click(function () {
? ? ? ? $("#login-box").show();
? ? ? ? $("#shadow").show();
? ? });
//關(guān)閉登錄框,點(diǎn)擊關(guān)閉按鈕關(guān)閉
$("#close-login-btn").click(function () {
? ? ? ? $("#login-box").hide();
? ? ? ? $("#shadow").hide();
? ? });以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- jQuery實(shí)現(xiàn)鼠標(biāo)拖拽登錄框移動效果
- jQuery實(shí)現(xiàn)百度登錄框的動態(tài)切換效果
- JQuery Mobile 彈出式登錄框的實(shí)現(xiàn)方法
- jquery中dom操作和事件的實(shí)例學(xué)習(xí) 仿yahoo郵箱登錄框的提示效果
- jquery鼠標(biāo)放上去顯示懸浮層即彈出定位的div層
- jquery實(shí)現(xiàn)鼠標(biāo)懸浮停止輪播特效
- jquery懸浮提示框完整實(shí)例
- jquery-tips懸浮提示插件分享
- js點(diǎn)擊出現(xiàn)懸浮窗效果不使用JQuery插件
- 使用jQuery UI的tooltip函數(shù)修飾title屬性的氣泡懸浮框
相關(guān)文章
jquery.cookie.js 操作cookie實(shí)現(xiàn)記住密碼功能的實(shí)現(xiàn)代碼
jquery.cookie.js操作cookie實(shí)現(xiàn)記住密碼功能,很簡單很強(qiáng)大,喜歡的朋友可以參考下。2011-04-04
jquery實(shí)現(xiàn)在頁面加載的時(shí)自動為日期插件添加當(dāng)前日期
這篇文章主要介紹了通過jquery實(shí)現(xiàn)在頁面加載的時(shí)自動為日期插件添加當(dāng)前日期,需要的朋友可以參考下2014-08-08
Jquery之Ajax運(yùn)用 學(xué)習(xí)運(yùn)用篇
JQuery中Ajax的運(yùn)用相信很多人都已熟悉,本文主要是記錄下個(gè)人實(shí)踐中的應(yīng)用知識,旨在加強(qiáng)記憶。2011-09-09
artDialog雙擊會關(guān)閉對話框的修改過程分享
artDialog,一個(gè)jquery的對話框插件但是在使用時(shí)發(fā)現(xiàn)鼠標(biāo)雙擊時(shí)會自半對話框,下面與大家分享下具體的修改過程,感興趣的朋友可以參考下2013-08-08
jQuery清除定時(shí)任務(wù)的實(shí)現(xiàn)
jQuery中使用setInterval函數(shù)設(shè)置定時(shí)任務(wù),并通過clearInterval函數(shù)來清除這些任務(wù),從而避免資源浪費(fèi)或邏輯混亂,具有一定的參考價(jià)值,感興趣的可以了解一下2024-09-09

