jQuery+jqmodal彈出窗口實(shí)現(xiàn)代碼分明
先上圖,最終效果如下
點(diǎn)擊“信息確認(rèn)”
就是彈出一個(gè)確認(rèn)窗口,把已經(jīng)填報(bào)的信息都放到里面看看。
信息放里面很簡(jiǎn)答,主要是彈出窗口要做得好看點(diǎn)。
所以選擇了jQuery+jqmodal實(shí)現(xiàn)
實(shí)現(xiàn)方法如下
1、頁(yè)面中引用jquery-1.4.2.js和jqModal.js,注意jQuery要在前面,因?yàn)閖qmodal是以jQuery為基礎(chǔ)的。
2、建立jqModal.css,并引用,主要是些美工的東東,注意div.jqmDialog 的 display為 none。高度和寬度要設(shè)置好,擋住下面的,好看~~,我偷個(gè)懶,把jqmodal示例的css稍微改了下:)如下:
/*div.whiteOverlay { background: url(dialog/jqmBG.gif) white; }*/
div.jqDrag {cursor: move;}
/* jqmModal dialog CSS courtesy of;
Brice Burgess <bhb@iceburg.net> */
div.jqmDialog {
display: none;
position: fixed;
top: 106px;
left: 50%;
margin-left: -450px;
width: 900px;
overflow: hidden;
font-family:verdana,tahoma,helvetica;
}
/* Fixed posistioning emulation for IE6
Star selector used to hide definition from browsers other than IE6
For valid CSS, use a conditional include instead */
* html div.jqmDialog {
position: absolute;
top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
}
/* [[[ Title / Top Classes ]]] */
div.jqmdTC {
background: #d5ff84 url(dialog/sprite.gif) repeat-x 0px -82px;
color: #528c00;
padding: 7px 22px 5px 5px;
font-family:"sans serif",verdana,tahoma,helvetica;
font-weight: bold;
* zoom: 1;
}
div.jqmdTL { background: url(dialog/sprite.gif) no-repeat 0px -41px; padding-left: 3px;}
div.jqmdTR { background: url(dialog/sprite.gif) no-repeat right 0px; padding-right: 3px; * zoom: 1;}
/* [[[ Body / Message Classes ]]] */
div.jqmdBC {
background: url(dialog/bc.gif) repeat-x center bottom;
padding: 7px 7px 7px;
height: 630px;
overflow: auto;
}
div.jqmdBL { background: url(dialog/bl.gif) no-repeat left bottom; padding-left: 7px; }
div.jqmdBR { background: url(dialog/br.gif) no-repeat right bottom; padding-right: 7px; * zoom: 1 }
div.jqmdMSG { color: #317895; font-size:large; }
/* [[[ Button classes ]]] */
input.jqmdX {
position: absolute;
right: 7px;
top: 4px;
padding: 0 0 0 19px;
height: 19px;
width: 0px;
background: url(dialog/close.gif) no-repeat top left;
overflow: hidden;
}
input.jqmdXFocus {background-position: bottom left; outline: none;}
div.jqmdBC button, div.jqmdBC input[type="submit"] {
margin: 8px 10px 4px 10px;
color: #777;
background-color: #fff;
cursor: pointer;
}
div.jqmDialog input:focus, div.jqmDialog input.iefocus { background-color: #eaffc3; }
3、在網(wǎng)頁(yè)里面建立彈出窗口的div,注意class="jqmDialog"(就是css里面隱藏的那個(gè))
4、在這個(gè)div里面把需要顯示的東東整好~~過(guò)程略:)
5、建立jquerywin.js并引用,注意放到j(luò)qmodal引用的后面,原因同上~~,代碼如下:
$().ready(function() {
$('#ex3a').jqm({
trigger: '#ex3aTrigger',
overlay: 30, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */
overlayClass: 'whiteOverlay'});
/* make dialog draggable, assign handle to title */
// Close Button Highlighting. IE doesn't support :hover. Surprise?
$('input.jqmdX')
.hover(
function(){ $(this).addClass('jqmdXFocus'); },
function(){ $(this).removeClass('jqmdXFocus'); })
.focus(
function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); })
.blur(
function(){ $(this).removeClass('jqmdXFocus'); });
});
6、注意,里面設(shè)置了一個(gè)trigger,可以出發(fā)彈出窗口,也可以不用trigger,直接使用js出發(fā),方法如下:
<script type="text/javascript" language=javascript>
function showjqm(){
if(document.all.txtTIME_KUAIJI.value!=""){
document.all.txtTIME_KUAIJI0.style.color="#317895";
document.all.txtTIME_KUAIJI0.innerHTML=document.all.txtTIME_KUAIJI.value;}
else{
document.all.txtTIME_KUAIJI0.style.color="Red";
}
if(document.all.txtTIME_BIRTH.value!=""){
document.all.txtTIME_BIRTH0.style.color="#317895";
document.all.txtTIME_BIRTH0.innerHTML=document.all.txtTIME_BIRTH.value;}
else{
document.all.txtTIME_BIRTH0.style.color="Red";
}
if( Page_ClientValidate())
$('#ex3a').jqmShow();
}
</script>
7、在上面的js里面,其實(shí)和彈出窗口直接相關(guān)的只有一句$('#ex3a').jqmShow(); 其他的都是驗(yàn)證的信息
8、上面的一段js里面,比較重要的還有這句if( Page_ClientValidate()) ,可以在彈出窗口之前直行頁(yè)面中所有驗(yàn)證控件的驗(yàn)證工作。
- Jquery實(shí)現(xiàn)自定義彈窗示例
- 小巧強(qiáng)大的jquery layer彈窗彈層插件
- jQuery實(shí)現(xiàn)彈窗居中效果類似alert()
- 運(yùn)用JQuery的toggle實(shí)現(xiàn)網(wǎng)頁(yè)加載完成自動(dòng)彈窗
- jquery模擬alert的彈窗插件
- jquery彈窗插件colorbox綁定動(dòng)態(tài)生成元素的方法
- jQuery實(shí)現(xiàn)簡(jiǎn)單彈窗遮罩效果
- jquery ezUI 雙擊行記錄彈窗查看明細(xì)的實(shí)現(xiàn)方法
- jquery實(shí)現(xiàn)彈出窗口效果的實(shí)例代碼
- Jquery彈出窗口插件 LeanModal的使用方法
- jQuery Mobile彈出窗、彈出層知識(shí)匯總
- jQuery實(shí)現(xiàn)的兩種簡(jiǎn)單彈窗效果示例
相關(guān)文章
jQuery事件模型默認(rèn)行為執(zhí)行順序及trigger()與 triggerHandler()比較實(shí)例分析
這篇文章主要介紹了jQuery事件模型默認(rèn)行為執(zhí)行順序及trigger()與 triggerHandler()比較,結(jié)合實(shí)例形式分析了jQuery事件模型默認(rèn)行為執(zhí)行順序相關(guān)原理,以及trigger()與 triggerHandler()的異同點(diǎn)比較,需要的朋友可以參考下2020-04-04
簡(jiǎn)單常用的幻燈片播放實(shí)現(xiàn)代碼
幻燈片自動(dòng)播放圖片是當(dāng)前網(wǎng)站比較流行的一個(gè)展示方式,這里項(xiàng)目需要,我自己做了一個(gè)簡(jiǎn)單的,就不詳細(xì)講解了,代碼很簡(jiǎn)單。直接看效果圖和代碼吧,希望對(duì)大家有所幫助2013-09-09
jQuery實(shí)現(xiàn)異步獲取json數(shù)據(jù)的2種方式
這篇文章主要介紹了jQuery實(shí)現(xiàn)異步獲取json數(shù)據(jù)的2種方式,主要講述了$.getJSON方法與$.ajax方法,非常實(shí)用,需要的朋友可以參考下2014-08-08
jquery寫個(gè)checkbox——類似郵箱全選功能
最近在學(xué)習(xí)jquery,今天抽空用jquery寫個(gè)checkbox——類似郵箱全選功能,感興趣的你可以參考下哈,希望可以幫助到你2013-03-03
jQuery實(shí)現(xiàn)表單動(dòng)態(tài)添加數(shù)據(jù)并提交的方法
這篇文章主要介紹了jQuery實(shí)現(xiàn)表單動(dòng)態(tài)添加數(shù)據(jù)并提交的方法,結(jié)合實(shí)例形式總結(jié)分析了jQuery針對(duì)存在form表單的添加、提交,不存在form表單的添加、提交,ajax、非ajax形式提交等數(shù)據(jù)添加與表單提交操作技巧,需要的朋友可以參考下2018-07-07
jQuery中設(shè)置form表單中action值的實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇jQuery中設(shè)置form表單中action值的實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
bootstrap table 服務(wù)器端分頁(yè)例子分享
這篇文章主要介紹了bootstrap table 服務(wù)器端分頁(yè)例子分享,需要的朋友可以參考下2015-02-02
使用ajax+jqtransform實(shí)現(xiàn)動(dòng)態(tài)加載select
本文給大家介紹了使用ajax+jqtransform實(shí)現(xiàn)動(dòng)態(tài)加載select,效果非常的不錯(cuò),這里推薦給大家,有需要的小伙伴直接拿走使用。2014-12-12



