asp.net中这种滚动图片是什么广告控件?
3个回答
展开全部
给你一个示例 代码!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Js幻灯片</title>
<style type="text/css">
* {margin:0; padding:0;}
#focus {width:800px; height:280px; overflow:hidden; position:relative;}
#focus ul {height:280px; position:absolute;}
#focus ul li {float:left; width:800px; height:280px; overflow:hidden; position:relative; background:#000;}
#focus .btnBg {position:absolute; width:800px; height:20px; left:0; bottom:0; background:#000; text-align:right; color:#FFF;}
#focus .btn {position:absolute; width:780px; height:10px; padding:5px 10px;bottom:0; text-align:right; z-index:4}
#focus .btn span {display:block;width:25px; float:left; height:10px; font-size:10px; text-align:center; margin-left:5px; cursor:pointer; background:#fff;}
.title{ float:right; margin-right:20px;}
.red{ color:red;}
.sm{ text-align:right;position:absolute; bottom:0; right:0; width:800px; height:20px; line-height:20px; z-index:3;}
</style>
<script src="/ajaxjs/jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
var sWidth=$("#focus").width();
var sHeight = $("#focus").height();
var len=$("#focus ul li").length;
var sWidth=$("#focus").width();
var sm=$("<div class='sm'></div>")
var index=0;
var picTimer;
var btn="<div class='btnBg'></div><div class='btn'>";
for(var i=0;i<len; i++){
var ii=i+1;
btn +="<span>"+ii+"</span>";
}
$("#focus").append(btn);
$("#focus").append(sm);
$("#focus .btnBg").css("opacity",0.3);
$("#focus .btn span").css("opacity",0.4).mouseenter(function(){
index = $("#focus .btn span").index(this);
sh(index);//向上滚动则改为showTop,向左滚动则改为showLeft,渐隐渐现则为sh
}).eq(0).trigger("mouseenter");
$("#focus").hover(function(){
clearInterval(picTimer);
},function(){
picTimer=setInterval(function(){
sh(index);//向上滚动则改为showTop,向左滚动则改为showLeft,渐隐渐现则为sh
index++;
if(index==len){index=0;}
},5000) //滚动间隔,数越大间隔越长
}).trigger("mouseleave");
function sh(index){
$("#focus ul").css({"width":sWidth,"height":sHeight});
var title=$("#focus img").eq(index).attr("title")
$(".sm").empty();
$(".sm").append(title)
$("#focus ul li img").css({position:"absolute",top:0,left:0}).parent().eq(index).stop(true,true).animate({"opacity":1},2000).css({display:"block"}).siblings().stop(true,true).animate({"opacity":0.2},1000).css({display:"none"});
$("#focus .btn span").stop(true,false).animate({"opacity":0.4},300).removeClass("red").eq(index).stop(true,false).animate({"opacity":0.8},300).addClass("red");
}
function showLeft(index){
$("#focus ul").css("width",sWidth*len);
var nowLeft=-index*sWidth;
var title=$("#focus img").eq(index).attr("title")
$("#focus .sm").empty();
$("#focus .sm").append(title)
$("#focus ul").stop(true,false).animate({"left":nowLeft},300);
$("#focus .btn span").stop(true,false).animate({"opacity":0.4},300).removeClass("red").eq(index).stop(true,false).animate({"opacity":0.8},300).addClass("red");
}
function showTop(index) {
$("#focus ul").css("height",sHeight*len);
var nowTop = -index*sHeight;
var title=$("img").eq(index).attr("title")
$(".sm").empty();
$(".sm").append(title)
$("#focus ul").stop(true,false).animate({"top":nowTop},300);
$("#focus .btn span").stop(true,false).animate({"opacity":"0.4"},300).removeClass("red").eq(index).stop(true,false).animate({"opacity":"1"},300).addClass("red");
}
})
</script>
</head>
<body>
<div id="focus">
<ul>
<li><img src="/jscss/demoimg/201208/Koala.jpg" width="800" height="280" title="卡拉"/></li>
<li><img src="/jscss/demoimg/201208/Lighthouse.jpg" width="800" height="280" title="海景房"/></li>
<li><img src="/jscss/demoimg/201208/Penguins.jpg" width="800" height="280" title="黄岛"/></li>
<li><img src="/jscss/demoimg/201208/Tulips.jpg" width="800" height="280" title="郁金香"/></li>
</ul>
</div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是一个jQuery插件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询