jquery制作漂亮的彈出層提示消息特效
今天給大家?guī)硪豢罨趈query超炫的彈出層提示消息。這款實(shí)例頁面初始時(shí),一個(gè)go按鈕。當(dāng)單擊go按鈕時(shí),提示強(qiáng)出層以動(dòng)畫形式出現(xiàn)。效果圖如下:

實(shí)現(xiàn)的代碼。
html代碼:
<div class='b'>
</div>
<div class='bb'>
</div>
<button id='go'>
GO
</button>
<div class='message'>
<div class='check'>
✔
</div>
<p>
Success
</p>
<p>
Check your email for a booking confirmation. We'll see you soon!
</p>
<button id='ok'>
OK
</button>
</div>
<script src='jquery.js'></script>
<script>
$('#go').click(function () {
go(50);
});
$('#ok').click(function () {
go(500);
});
setTimeout(function () {
go(50);
}, 700);
setTimeout(function () {
go(500);
}, 2000);
function go(nr) {
$('.bb').fadeToggle(200);
$('.message').toggleClass('comein');
$('.check').toggleClass('scaledown');
$('#go').fadeToggle(nr);
}
//@ sourceURL=pen.js
</script>
css代碼:
body, html
{
height: 100%;
font-size: 20px;
font-family: Source Sans Pro;
}
.b, .bb
{
position: absolute;
width: 100%;
height: 100%;
background: url("kje4L5j.jpg");
background-attachment: fixed;
background-size: cover;
background-position: center;
}
.bb
{
background: url("bDBs0et.jpg");
background-attachment: fixed;
background-size: cover;
background-position: center;
display: none;
}
#go
{
position: absolute;
top: 30px;
left: 50%;
transform: translate(-50%, 0%);
color: white;
border: 0;
background: #71c341;
width: 100px;
height: 30px;
border-radius: 6px;
font-size: 1rem;
transition: background 0.2s ease;
outline: none;
}
#go:hover
{
background: #8ecf68;
}
#go:active
{
background: #5a9f32;
}
.message
{
position: absolute;
top: -200px;
left: 50%;
transform: translate(-50%, 0%);
width: 300px;
background: white;
border-radius: 8px;
padding: 30px;
text-align: center;
font-weight: 300;
color: #2c2928;
opacity: 0;
transition: top 0.3s cubic-bezier(0.31, 0.25, 0.5, 1.5), opacity 0.2s ease-in-out;
}
.message .check
{
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, -50%) scale(4);
width: 120px;
height: 110px;
background: #71c341;
color: white;
font-size: 3.8rem;
padding-top: 10px;
border-radius: 50%;
opacity: 0;
transition: transform 0.2s 0.25s cubic-bezier(0.31, 0.25, 0.5, 1.5), opacity 0.1s 0.25s ease-in-out;
}
.message .scaledown
{
transform: translate(-50%, -50%) scale(1);
opacity: 1;
}
.message p
{
font-size: 1.1rem;
margin: 25px 0px;
padding: 0;
}
.message p:nth-child(2)
{
font-size: 2.3rem;
margin: 40px 0px 0px 0px;
}
.message #ok
{
position: relative;
color: white;
border: 0;
background: #71c341;
width: 100%;
height: 50px;
border-radius: 6px;
font-size: 1.2rem;
transition: background 0.2s ease;
outline: none;
}
.message #ok:hover
{
background: #8ecf68;
}
.message #ok:active
{
background: #5a9f32;
}
.comein
{
top: 150px;
opacity: 1;
}
以上就是基于jQuery制作的漂亮的彈出層提示特效的全部代碼了,非常的漂亮吧,小伙伴們可以直接使用到自己的項(xiàng)目中去。
相關(guān)文章
利用jQuery的$.event.fix函數(shù)統(tǒng)一瀏覽器event事件處理
做WEB前端開發(fā)的人都知道不同的瀏覽器對(duì)事件的處理方式是有區(qū)別的。2009-12-12
jquery的ajax()函數(shù)傳值中文亂碼解決方法介紹
jquery的ajax()函數(shù)傳值中文亂碼解決方法介紹,需要的朋友可以參考下2012-11-11
jquery中實(shí)現(xiàn)簡(jiǎn)單的tabs插件功能的代碼
jquery改變了程序員寫javascript的方式。作為jquery的愛好者和新手,最近我學(xué)會(huì)了用寥寥幾句jquery代碼實(shí)現(xiàn)類似tabs插件的功能,相信此文能為許多剛?cè)腴T的jquery愛好者和想實(shí)現(xiàn)tabs插件功能的朋友帶來一些幫助。2011-03-03
setInterval,setTimeout與jquery混用的問題
當(dāng)遇到setInterval,setTimeout與jquery混用的問題 時(shí),直接按JavaScript中的語法寫并不起作用,有以下兩種解決方法2013-04-04
jquery.autocomplete修改實(shí)現(xiàn)鍵盤上下鍵自動(dòng)填充示例
根據(jù)需求要實(shí)現(xiàn)通過鍵盤上下移動(dòng),獲得聯(lián)想菜單中的值,如同google baidu的查詢功能,下面的代碼是自己手寫的,喜歡的朋友可以嘗試操作下2013-11-11
如何使用jquery easyui創(chuàng)建標(biāo)簽組件
這篇文章主要介紹了如何使用jquery easyui創(chuàng)建標(biāo)簽組件的相關(guān)資料,需要的朋友可以參考下2015-11-11
基于jQuery實(shí)現(xiàn)select下拉選擇可輸入附源碼下載
一般的select下拉框是不能輸入的,只能供大家選擇,今天小編給大家分享基于jQuery實(shí)現(xiàn)select下拉選擇可輸入附源碼下載,需要的朋友參考下2016-02-02
jQuery實(shí)現(xiàn)手機(jī)自定義彈出輸入框
這篇文章主要介紹了jQuery實(shí)現(xiàn)手機(jī)自定義彈出輸入框 的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06

