国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

基于jQuery的仿flash的廣告輪播

2019-11-21 00:09:13
字體:
來源:轉載
供稿:網友
整個頁面如下:
復制代碼 代碼如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!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 runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="_Template/js/blockSlide.js" type="text/javascript"></script>
<style type="text/css">
div#imgADPlayer
{
margin: auto;
margin-bottom: 4px;
width: 960px;
height: 120px;
background: url(../images/photo_01.jpg) left top no-repeat;
padding: 0px;
border: none;
clear: both;
position: relative;
}
div#imgADPlayer .smask
{
position: absolute;
left: 0px;
top: 0px;
}
</style>
</head>
<body>
<!-- 滾動圖片開始 -->
<div id="imgADPlayer">
<div id="AdTop">
<div id="myjQueryContent">
<div>
<a href="javascript:void(0)">
<img src="_Template/images/photo_01.jpg" alt="" /></a></div>
<div class="smask">
<a href="javascript:void(0)">
<img src="_Template/images/photo_02.jpg" alt="" /></a></div>
<div class="smask">
<a href="javascript:void(0)">
<img src="_Template/images/photo_03.jpg" alt="" /></a>
</div>
<div class="smask">
<a href="javascript:void(0)">
<img src="_Template/images/photo_04.jpg" alt="" /></a></div>
</div>
<div id="flow">
</div>
</div>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$("#AdTop").blockSlide({
speed: "normal",
num: 4,
timer: 3000,
flowSpeed: 300
});
});
</script>
</div>
<!--滾動圖片結束 -->
</body>
</html>


注釋:
speed:圖片輪播速度
num:圖片數量
timer:自動輪播的時間間隔,定時器;
flowSpeed:是滑塊移動的速速度

blockSlide插件源碼如下:
復制代碼 代碼如下:

/**
* @author huajianhuakai */
(function($)
{
$.fn.blockSlide = function(settings)
{
settings = jQuery.extend({
speed: "normal",
num: 4,
timer: 1000,
flowSpeed: 300
}, settings);
return this.each(function()
{
$.fn.blockSlide.scllor($(this), settings);
});
};
$.fn.blockSlide.scllor = function($this, settings)
{
var index = 0;
var imgScllor = $("div:eq(0)>div", $this);
var timerID;
//自動播放
var MyTime = setInterval(function()
{
ShowjQueryFlash(index);
index++;
if (index == settings.num)
index = 0;
}, settings.timer);
var ShowjQueryFlash = function(i)
{
$(imgScllor).eq(i).animate({ opacity: 1 }, settings.speed).css({ "z-index": "100" }).siblings().animate({ opacity: 0 }, settings.speed).css({ "z-index": "0" });
}
}
})(jQuery);


希望對和我一樣的菜鳥有用
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 措勤县| 聊城市| 巴林右旗| 景泰县| 大英县| 洛宁县| 新余市| 台江县| 弥渡县| 万州区| 临沧市| 定南县| 白沙| 江华| 南投市| 武陟县| 寿阳县| 临颍县| 武定县| 新晃| 长治县| 许昌县| 青岛市| 邯郸市| 洞头县| 琼中| 定西市| 巴林右旗| 阿克苏市| 广河县| 浦江县| 农安县| 东辽县| 凯里市| 鹤岗市| 徐汇区| 郧西县| 张家港市| 石台县| 金山区| 运城市|