Home > Web Front-end > JS Tutorial > jQuery-based message prompt plug-in DivAlert journey (2)_jquery

jQuery-based message prompt plug-in DivAlert journey (2)_jquery

WBOY
Release: 2016-05-16 18:30:40
Original
1153 people have browsed it

The improved code part is mainly as follows:
1. Create the default.css file:
Code

Copy code The code is as follows :

img
{
vertical-align:middle;
}
.jBg
{
position: absolute;
top: 0 ;
left: 0;
z-index: 9999;
background-color: #999;
filter: alpha(opacity=70);
opacity: 0.7;
}
.jWrap
{
position: absolute;
border: 1px solid #cef;
z-index: 10000;
overflow: hidden;
}
. jTit
{
text-align: left;
background:#F1F1F1;
padding: 8px;
cursor: move;
height: 20px;
vertical-align: middle;
border-bottom:1px solid #DEDEDE;
text-indent:5px;
font-size:15px;
line-height:20px;
}
.jCon
{
background-color: #fff;
padding: 10px 13px;
overflow: auto;
font-size:15px;
}
.jBtn, jBtn: hover
{
cursor:pointer;
height:17px;
width:17px;
}
.jBtn
{
background:transparent url(close.png ) no-repeat;
position:absolute;
right:8px;
top:7px;
}
.jBtn:hover
{
background:transparent url(close .png) no-repeat -19px 0px;
}
.jConBottom
{
background:#F1F1F1;
text-align:right;
width:100%;
height:41px;
position:absolute;
}
.jBtnConfirm
{
background:url(btn.png) no-repeat 0 -24px transparent;
cursor:pointer ;
color:#3F3F3F;
width:46px;
height:21px;
line-height:23px;
text-align:center;
font-size:12px;
float:right;
margin-top:10px;
margin-right:10px;
}


2. Modify the JS default options section (so that Cooperate with css files):
Copy code The code is as follows:

options.bgClass = o. bgClass || 'jBg';
options.wrapClass = o.wrapClass || 'jWrap';
options.titClass = o.titClass || 'jTit';
options.conClass = o.conClass | | 'jCon';
options.clsClass = o.clsClass || 'jBtn';
options.botDivClass = o.botDivClass || 'jBot';
options.botBtnClass = o.botBtnClass || ' jBotBtn';

3. Since I only built two divs for title and content before, in order to achieve the effect, I need to add two divs, one is the big div at the bottom, and the other is OK button
Copy code The code is as follows:

//Create a div containing the OK button at the bottom
var $conBottomDiv = createElement("div")
.addClass('jConBottom')
.css('top', options.height - $titDiv.outerHeight() -40 'px');

//Create the bottom OK button
var $conBottomBtn = createElement("div")
.addClass('jBtnConfirm')
.html('OK')
.click( close);

Finally, don’t forget to attach these two pieces at the required locations when the Dom is created and it will be ok. . .
Rendering:
jQuery-based message prompt plug-in DivAlert journey (2)_jquery
Decorated it, it does look better than before^_^
Code package download

Journey of jQuery-based pop-up message plug-in DivAlert (1)

Journey of jQuery-based message prompt plug-in DivAlert (2)

JQuery-based message prompt plug-in DivAlert journey (3) Recommended
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template