Jquery實(shí)現(xiàn)頂部彈出框特效
Jq制作的頁面頂部動(dòng)態(tài)彈出的提示框,可以用于提示信息的顯示以及通知信息的顯示。
Html代碼
<div class="tooltiptop"> <div class="bg"></div> <div class="main"><i>Jq頂部彈出框</i><span onClick="ToolTipTop.Hide();" title="關(guān)閉">X</span></div> </div>
Css代碼
body { margin: 0; padding: 0; } .tooltiptop { width: 100%; height: 50px; margin-top:-50px; display:none; } .tooltiptop .bg { width: 100%; background-color: #333; height: 50px; opacity: .7; position: absolute; margin: 0; } .tooltiptop .main { width: 100%; position: absolute; margin: 0; height: 50px; line-height: 50px; text-align: center; color: #fff; } .tooltiptop .main span { float: right; color: #fff; margin-right: 20px; cursor: pointer; }
Jq代碼
var ToolTipTop={ Show:function(Msg){ $(".tooltiptop .main i").html(Msg); $(".tooltiptop").css("display","block").animate({marginTop:"0px"},500); }, Hide:function(){ $(".tooltiptop").animate({marginTop:"-50px"},500,function(){$(this).css("display","none")}); } }
再給大家分享一例特效,效果也非常不錯(cuò)
CSS
<style type="text/css"> *{margin:0;padding:0;list-style-type:none;} a,img{border:0;} .demo{margin:0 auto 0 auto;padding:200px 0 0 0;width:400px;text-align:center;font-size:18px;} .demo .action{color:#3366cc;text-decoration:none;font-family:"微軟雅黑","宋體";} #Header{ position:fixed;z-index:9999999;top:0;right:0;left:0;height:38px;border-bottom:1px solid #e0dede;width:100%; background-color:#F7F7F7; background-image:linear-gradient(#fff, #f7f6f5); background-image:-moz-linear-gradient(#fff, #f7f6f5); background-image:-o-linear-gradient(#fff, #f7f6f5); background-image:-webkit-linear-gradient(#fff, #f7f6f5); box-shadow:inset 0 1px #fff, 0 1px 3px rgba(34,25,25,0.4); -moz-box-shadow:inset 0 1px #fff, 0 1px 2px rgba(34,25,25,0.4); -webkit-box-shadow:inset 0 1px #fff, 0 1px 3px rgba(34,25,25,0.4); } *html,*html body{background-image:url(about:blank);background-attachment:fixed;} *html #Header{position:absolute;top:expression(eval(document.documentElement.scrollTop));} .overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:998;width:100%;height:100%;background:#f6f4f5;display:none;} *html,*html body{background-image:url(about:blank);background-attachment:fixed;} *html .destroy,*html .overlay{position:absolute;top:expression(eval(document.documentElement.scrollTop));} .destroy{position:fixed;top:0px;left:50%;margin-left:-425px;*margin-left:-718px;_margin-left:-425px;margin-top:-292px;z-index:99996;opacity:0;filter:alpha(opacity=0);} .sheet{position:relative;width:840px;height:290px;margin:auto;padding:0;background:#fff9e2 url("images/tips_bg.gif"); box-shadow:inset 0 -1px 0 #FFF,0 1px 6px rgba(0,0,0,.3); -moz-box-shadow:inset 0 -1px 0 #FFF,0 1px 6px rgba(0,0,0,.3); -webkit-box-shadow:inset 0 -1px 0 #FFF,0 1px 6px rgba(0,0,0,.3); border-bottom:2px solid #efebda; border-bottom-left-radius:5px; border-bottom-right-radius:5px; -moz-border-bottom-left-radius:5px; -moz-border-bottom-right-radius:5px; -webkit-border-bottom-left-radius:5px; -webkit-border-bottom-right-radius:5px; } .sheet a.close{display:block;position:absolute;width:20px;height:20px;right:5px;top:5px;background:url("images/sheet_close.gif") no-repeat;} .sheet a:hover.close{background-position:0 -30px;} .sheet a:active.close{background-position:0 -60px;} .sheet .head{padding:20px 15px;border-bottom:1px solid #f6f4ee;} .sheet .head h2{padding:0;font-size:18px;font-weight:400;color:#444;text-align:center;} .sheet .body{padding:10px 15px;border-top:1px solid #fff;} </style>
JS
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var h = $(document).height(); $(".overlay").css({"height": h }); $(".action").click(function(){ $(".overlay").css({'display':'block'}).animate({'opacity':'0.8'}); $(".destroy").stop(true).animate({'margin-top':'40px','opacity':'1'},400); }); $(".close").click(function(){ $(".destroy").stop(true).animate({'margin-top':'-292px','opacity':'0'},800); $(".overlay").css({'display':'none'}).animate({'opacity':'0'}); }); }); </script>
HTML
<div id="Header"></div> <div class="demo"><a class="action" href="javascript:void(0);">jquery float浮動(dòng)層彈出層頁面加載特效</a></div> <div class="overlay"></div> <div class="destroy"> <div class="sheet"> <div class="head"> <h2>jquery頂部動(dòng)畫彈出層</h2> </div> <div class="body"></div> <a class="close" title="關(guān)閉" href="#"></a> </div> </div><!--sheet end-->
- jQuery實(shí)現(xiàn)固定在網(wǎng)頁頂部的菜單效果代碼
- jquery小火箭返回頂部代碼分享
- jQuery實(shí)現(xiàn)返回頂部效果的方法
- jQuery 頂部導(dǎo)航跟隨滾動(dòng)條滾動(dòng)固定浮動(dòng)在頂部
- 使用jquery animate創(chuàng)建平滑滾動(dòng)效果(可以是到頂部、到底部或指定地方)
- jQuery設(shè)置div一直在頁面頂部顯示的方法
- jquery 跳到頂部和底部動(dòng)畫2句代碼簡單實(shí)現(xiàn)
- jquery scrollTop方法根據(jù)滾動(dòng)像素顯示隱藏頂部導(dǎo)航條
- jQuery回到頂部的代碼
相關(guān)文章
開發(fā)插件的兩個(gè)方法jquery.fn.extend與jquery.extend
jQuery為開發(fā)插件提拱了兩個(gè)方法,分別是jquery.fn.extend與jquery.extend,接下來就為大家介紹下兩者的具體使用2013-11-11jQuery 同時(shí)獲取多個(gè)標(biāo)簽的指定內(nèi)容并儲(chǔ)存為數(shù)組
這篇文章主要介紹了jQuery 同時(shí)獲取多個(gè)標(biāo)簽的指定內(nèi)容并儲(chǔ)存為數(shù)組的相關(guān)知識(shí),非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-11-11快速掌握jquery分頁插件jqPaginator的使用方法
這篇文章主要幫助大家快速掌握jquery分頁插件jqPaginator的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08jQuery實(shí)現(xiàn)的導(dǎo)航下拉菜單效果
這篇文章主要介紹了jQuery實(shí)現(xiàn)的導(dǎo)航下拉菜單效果,涉及jQuery響應(yīng)鼠標(biāo)事件動(dòng)態(tài)操作頁面元素的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2016-07-07jQuery如何實(shí)現(xiàn)點(diǎn)擊頁面獲得當(dāng)前點(diǎn)擊元素的id或其他信息
點(diǎn)擊頁面獲得當(dāng)前點(diǎn)擊元素的id或者其他信息,使用jquery可以輕松做到這一點(diǎn),下面有個(gè)不錯(cuò)的示例,希望對(duì)大家有所幫助2014-01-01BootStrap日期控件在模態(tài)框中選擇時(shí)間下拉菜單無效的原因及解決辦法(火狐下不能點(diǎn)擊)
今天同事讓我?guī)退黄鸾鉀Q一個(gè)問題,關(guān)于兼容的bug問題,在火狐中使用模態(tài)框加載日期控件時(shí)選擇時(shí)間下拉菜單沒有效果(不能點(diǎn)擊),而在谷歌中卻是好的,下面小編附上原因分析及解決辦法,有需要的朋友可以參考下2016-08-08