jquery實現可關閉的倒計時廣告特效代碼,jquery特效代碼

來源:互聯網
上載者:User

jquery實現可關閉的倒計時廣告特效代碼,jquery特效代碼

本文執行個體講述了jquery實現可關閉的倒計時廣告特效代碼。分享給大家供大家參考。具體如下:

這是一款類似播放視頻時候最開始的倒計時廣告,廣告時間結束才能看到視頻內容,一個JS小彈跳式廣告代碼,右上方帶關閉按鈕,左上方顯示倒計時剩餘時間,運行jQuery代碼綜合實現,CSS和HTML共同結合的網頁特效,相容各主流瀏覽器,本效果是從門戶網站上整理而來。希望大家喜歡。

先來看看運行效果:

線上示範地址如下:

http://demo.jb51.net/js/2015/jquery-close-time-adv-style-codes/

具體代碼如下:

<!DOCTYPE html><html><head><meta charset="gb2312"><title>js貼片倒計時代碼</title><style>*{padding:0;margin:0; font-size:12px;}ol,ul,li{list-style:none}img{border:none}.box{ width:564px; height:361px; margin:20px auto; position:relative; display:none;}.ad_time{ width:554px; height:351px; background:#000; filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5; padding:5px; position:absolute; top:0; left:0; color:#fff;}.ad_time span{ font-weight:bold; color:#cc0; padding:0 5px;}.close{ width:49px; height:20px; background:url(images/close.png) no-repeat; position:absolute; top:0; right:0; cursor:pointer;}.btn{ width:100px; height:30px; background:#eee; border:1px solid #ddd; font:normal 12px/30px '寰蔣闆呴粦'; text-align:center; margin:20px auto; cursor:pointer;}</style><script type="text/javascript" src="jquery-1.6.2.min.js" language="javascript"></script><script type="text/javascript" language="javascript">function lxfEndtime(){ $t=$('#t').html(); if($t!=0){  $('#t').html($t-1);  $i=setTimeout("lxfEndtime()",1000); }else{    $('.box').hide();  $('.btn').show();  $('#t').html(6);  $('.ad_time').css({'width':'554px','height':'351px'});  clearTimeout($i); }};$(document).ready(function(){ $('.btn').live('click',function(){  $('.box').show();  $(this).hide();   $('.ad_time').animate({width:110,height:18},'slow');  lxfEndtime(); }) $('.close').click(function(){  $('.box').hide();  $('.btn').show();  $('#t').html(6);  $('.ad_time').css({'width':'554px','height':'351px'});  clearTimeout($i); })});</script></head><body><!--代碼開始--><div class="box"> <div class="ad"><a href="#" target="_blank"><img src="images/ad.jpg" /></a></div> <div class="ad_time">時間還剩<span id="t">50</span>秒</div> <div class="close"></div></div><div class="btn">點擊顯示效果</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.