整个页面如下:
复制代码 代码如下:
<%@ 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="/UploadFiles/2021-04-02/jquery-1.4.1-vsdoc.js"><script src="_Template/js/blockSlide.js"><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="/UploadFiles/2021-04-02/photo_01.jpg"><div class="smask">
<a href="javascript:void(0)">
<img src="_Template/images/photo_02.jpg"><div class="smask">
<a href="javascript:void(0)">
<img src="/UploadFiles/2021-04-02/photo_03.jpg"></div>
<div class="smask">
<a href="javascript:void(0)">
<img src="/UploadFiles/2021-04-02/photo_04.jpg"></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);
复制代码 代码如下:
<%@ 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="/UploadFiles/2021-04-02/jquery-1.4.1-vsdoc.js"><script src="_Template/js/blockSlide.js"><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="/UploadFiles/2021-04-02/photo_01.jpg"><div class="smask">
<a href="javascript:void(0)">
<img src="_Template/images/photo_02.jpg"><div class="smask">
<a href="javascript:void(0)">
<img src="/UploadFiles/2021-04-02/photo_03.jpg"></div>
<div class="smask">
<a href="javascript:void(0)">
<img src="/UploadFiles/2021-04-02/photo_04.jpg"></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);
标签:
广告轮播
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“基于jQuery的仿flash的广告轮播代码”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。