jquery實(shí)現(xiàn)界面點(diǎn)擊按鈕彈出懸浮框
本文實(shí)例為大家分享了jquery實(shí)現(xiàn)界面點(diǎn)擊按鈕彈出懸浮框的具體代碼,供大家參考,具體內(nèi)容如下
首先定義兩個(gè)div:
一個(gè)是背景,一個(gè)是懸浮窗。
<input id="Button1" type="button" value="點(diǎn)擊彈出層"/>? ? ? ? ?? ??? ?<!--彈出層時(shí)背景層DIV--> ?? ??? ?<div id="fade" class="black_overlay"></div> ?? ??? ?<!-- 編輯框 可以加自己的樣式 --> ?? ??? ?<div id="MyDiv" class="white_content"> ?? ??? ??? ?點(diǎn)擊陰影處退出?。。? </div>
css樣式:
<style> ?? ??? ??? ?.black_overlay { ? ? ? ? ? ? display: none; ? ? ? ? ? ? position: absolute; ? ? ? ? ? ? top: 0%; ? ? ? ? ? ? left: 0%; ? ? ? ? ? ? width: 100%; ? ? ? ? ? ? height: 100%; ? ? ? ? ? ? background-color: black; ? ? ? ? ? ? z-index: 1001; ? ? ? ? ? ? -moz-opacity: 0.8; ? ? ? ? ? ? opacity: .80; ? ? ? ? ? ? filter: alpha(opacity=80); ? ? ? ? } ? ? ? ? .white_content { ? ? ? ? ? ? display: none; ? ? ? ? ? ? position: absolute; ? ? ? ? ? ? top: 10%; ? ? ? ? ? ? left: 10%; ? ? ? ? ? ? width: 80%; ? ? ? ? ? ? height: 80%; ? ? ? ? ? ? border: 16px solid lightblue; ? ? ? ? ? ? background-color: white; ? ? ? ? ? ? z-index: 1002; ? ? ? ? ? ? overflow: auto; ? ? ? ? } ? ? ? ? .white_content_small { ? ? ? ? ? ? display: none; ? ? ? ? ? ? position: absolute; ? ? ? ? ? ? top: 20%; ? ? ? ? ? ? left: 30%; ? ? ? ? ? ? width: 40%; ? ? ? ? ? ? height: 50%; ? ? ? ? ? ? border: 16px solid lightblue; ? ? ? ? ? ? background-color: white; ? ? ? ? ? ? z-index: 1002; ? ? ? ? ? ? overflow: auto; ? ? ? ? } </style>
jquery方法:
<script type="text/javascript"> ?? ??? ?$("#Button1").click(function() { ?? ??? ??? ?document.getElementById("MyDiv").style.display = 'block'; ?? ??? ??? ?document.getElementById("fade").style.display = 'block'; ?? ??? ??? ?var bgdiv = document.getElementById("fade"); ?? ??? ??? ?bgdiv.style.width = document.body.scrollWidth; ?? ??? ??? ?$("#fade").height($(document).height()); ?? ??? ?}); ?? ??? ?//關(guān)閉彈出層 ?? ??? ?$("#fade").click(function() { ?? ??? ??? ?document.getElementById("MyDiv").style.display = 'none'; ?? ??? ??? ?document.getElementById("fade").style.display = 'none'; ?? ??? ?}); </script>
效果圖:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- jQuery實(shí)現(xiàn)首頁懸浮框
- 使用jQuery UI的tooltip函數(shù)修飾title屬性的氣泡懸浮框
- jQuery實(shí)現(xiàn)單擊按鈕遮罩彈出對(duì)話框效果(2)
- jQuery實(shí)現(xiàn)單擊按鈕遮罩彈出對(duì)話框效果(1)
- jQuery點(diǎn)擊按鈕彈出遮罩層且內(nèi)容居中特效
- jQuery實(shí)現(xiàn)點(diǎn)擊按鈕彈出可關(guān)閉層的浮動(dòng)層插件
- jQuery實(shí)現(xiàn)單擊按鈕遮罩彈出對(duì)話框(仿天貓的刪除對(duì)話框)
- 基于Jquery的仿Windows Aero彈出窗(漂亮的關(guān)閉按鈕)
相關(guān)文章
jQuery+PHP+Mysql實(shí)現(xiàn)抽獎(jiǎng)程序
這篇文章主要為大家詳細(xì)介紹了jQuery+PHP+Mysql實(shí)現(xiàn)抽獎(jiǎng)程序,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05jQuery實(shí)現(xiàn)廣告條滾動(dòng)效果
這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)廣告條滾動(dòng)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08jquery 單引號(hào)和雙引號(hào)的區(qū)別及使用注意
在js中單引號(hào)和雙引號(hào)都是一樣的,平時(shí)使用的時(shí)候盡量用單引號(hào),只有碰到嵌套的時(shí)候才會(huì)同時(shí)用兩種引號(hào),感興趣的朋友可以了解下2013-07-07jQuery實(shí)現(xiàn)圖片輪播效果代碼(基于jquery.pack.js插件)
這篇文章主要介紹了jQuery實(shí)現(xiàn)圖片輪播效果的方法,該功能基于jquery.pack.js插件實(shí)現(xiàn),涉及jQuery針對(duì)頁面元素與樣式的動(dòng)態(tài)操作技巧,需要的朋友可以參考下2016-06-06jQuery對(duì)象和Javascript對(duì)象之間轉(zhuǎn)換的實(shí)例代碼
jQuery對(duì)象和Javascript對(duì)象之間轉(zhuǎn)換的實(shí)例代碼,需要的朋友可以參考一下2013-03-03Jquery判斷radio、selelct、checkbox是否選中及獲取選中值方法總結(jié)
這篇文章主要介紹了Jquery判斷radio、selelct、checkbox是否選中及獲取選中值方法總結(jié),本文總結(jié)的比較簡(jiǎn)潔直白,看到的朋友按需索取,需要的朋友可以參考下2015-04-04jQuery實(shí)現(xiàn)的滑塊滑動(dòng)導(dǎo)航效果示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)的滑塊滑動(dòng)導(dǎo)航效果,涉及jQuery事件響應(yīng)及頁面元素動(dòng)態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-06-06如何將 jQuery 從你的 Bootstrap 項(xiàng)目中移除(取而代之使用Vue.js)
Bootstrap是網(wǎng)上最流行的前端開發(fā)框架。下面通過本文給大家分享將 jQuery 從你的 Bootstrap 項(xiàng)目中移除的方法,需要的的朋友參考下吧2017-07-07jquery+ajax+C#實(shí)現(xiàn)無刷新操作數(shù)據(jù)庫(kù)數(shù)據(jù)的簡(jiǎn)單實(shí)例
本篇文章主要是對(duì)jquery+ajax+C#實(shí)現(xiàn)無刷新操作數(shù)據(jù)庫(kù)數(shù)據(jù)的簡(jiǎn)單實(shí)例進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2014-02-02