jquery實現點擊彈出帶標題列的彈出層(從右上方飛入)效果,jquery標題列

來源:互聯網
上載者:User

jquery實現點擊彈出帶標題列的彈出層(從右上方飛入)效果,jquery標題列

本文執行個體講述了jquery實現點擊彈出帶標題列的彈出層(從右上方飛入)效果。分享給大家供大家參考。具體如下:

這是一款jquery實現的彈出層,點擊文字後從網頁右上方飛入,也可以說是滑入,此類彈出框帶有關閉按鈕,可自訂標題列和彈出框內容,風格自己可定義,代碼簡潔,基於jquery實現,學習參考價值大,也可拿出即用。

運行效果如下:

線上示範地址如下:

http://demo.jb51.net/js/2015/jquery-fade-in-title-info-stye-alert-codes/

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>jQuery從頁面右上方彈出的浮層代碼</title> <style>*{margin:0;padding:0;list-style-type:none;}body{font-family:'microsoft yahei';}a{text-decoration:none;}.showdiv{color:#fff;padding:8px 15px;background:#09F;text-align:center;display:block;width:150px;margin:100px auto;}.showbox{width:0px;height:0px;display:none;position:absolute;right:0;top:0;z-index:100;border:1px #8FA4F5 solid;padding:1px;background:#fff;}.showbox h2{height:25px;font-size:14px;background-color:#3366cc;position:relative;padding-left:10px;line-height:25px;color:#fff;}.showbox h2 a{position:absolute;right:5px;top:0;font-size:12px;color:#fff;}.showbox .mainlist{padding:10px;}.showbox .mainlist p{font:normal 14px/2 'microsoft yahei';text-indent:2em;color:#333;padding-top:5px;}#zhezhao{background-color:#666;position:absolute;z-index:99;left:0;top:0;display:none;width:100%;height:100%;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}</style><script type="text/javascript" src="jquery-1.6.2.min.js"></script><script type="text/javascript">$(document).ready(function(){ $(".showdiv").click(function(){  var box =300;  var th= $(window).scrollTop()+$(window).height()/1.6-box;  var h =document.body.clientHeight;  var rw =$(window).width()/2-box;  $(".showbox").animate({top:th,opacity:'show',width:600,height:340,right:rw},500);  $("#zhezhao").css({   display:"block",height:$(document).height()  });  return false; }); $(".showbox .close").click(function(){  $(this).parents(".showbox").animate({top:0,opacity: 'hide',width:0,height:0,right:0},500);  $("#zhezhao").css("display","none"); });});</script></head><body> <a class="showdiv" href="#">點擊我彈出浮層</a> <div class="showbox">  <h2>幫客之家簡介<a class="close" href="#">關閉</a></h2>  <div class="mainlist">   <p>幫客之家是國內專業的網站建設資源、指令碼編程學習類網站,提供最新的網路編程、指令碼編程、網頁製作、網頁設計、網頁特效,為站長與網路編程從業者提供學習資料。</p>  </div> </div>  <div id="zhezhao"></div><div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';"></div></body></html>

希望本文所述對大家的jQuery程式設計有所協助。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.