欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

仿迅雷焦點廣告效果(JQuery版)

 更新時間:2008年11月19日 12:42:00   作者:  
今天寫了一個放迅雷焦點廣告的效果,還請大家多多指正,先附上效果圖一張
首先是JS代碼部分,之前一定先引入JQuery包:
復(fù)制代碼 代碼如下:

$(document).ready(function(){
var imgUrl = new Array();
var title = new Array();
var description = new Array();
var imgLink = new Array();
var local;
var count;

local = 1; //指針位置
count = 7; //圖片數(shù)量
imgUrl[1] = "Images/ceshi.jpg";
imgUrl[2] = "Images/ceshi1.jpg";
imgUrl[3] = "Images/ceshi.jpg";
imgUrl[4] = "Images/ceshi1.jpg";
imgUrl[5] = "Images/ceshi.jpg";
imgUrl[6] = "Images/ceshi1.jpg";
imgUrl[7] = "Images/ceshi.jpg";
title[1] = "測試一下1";
title[2] = "測試一下2";
title[3] = "測試一下3";
title[4] = "測試一下4";
title[5] = "測試一下5";
title[6] = "測試一下6";
title[7] = "測試一下7";
description[1] = "描述一下1";
description[2] = "描述一下2";
description[3] = "描述一下3";
description[4] = "描述一下4";
description[5] = "描述一下5";
description[6] = "描述一下6";
description[7] = "描述一下7";
imgLink[1] = "ceshi1.asp";
imgLink[2] = "ceshi2.asp";
imgLink[3] = "ceshi3.asp";
imgLink[4] = "ceshi4.asp";
imgLink[5] = "ceshi5.asp";
imgLink[6] = "ceshi6.asp";
imgLink[7] = "ceshi7.asp";

function showImage(){
$("#Buttons div").each(function(){
if($(this).attr("id") == "B"+local){
$(this).attr("class","Menu_On");
$(this).addClass("active");
$("#AdImage").attr("src",imgUrl[local]);
$("#AdTitle a").html(title[local]);
$("#AdDescription a").html(description[local]);
$("#Images a").attr("href",imgLink[local]);
}else{
$(this).removeClass("active");
$(this).attr("class","Menu_Off");
}
});
local++;
if(local > count){
local = 1;
}
theTimer = setTimeout(function(){showImage()},3000);
}

$("#Buttons div").click(function(){
local = $(this).attr("id").replace("B","");
var cid = $(this).attr("id");
$("#Buttons div").each(function(){
if($(this).attr("id") == cid){
$(this).addClass("active");
$("#AdImage").attr("src",imgUrl[$(this).attr("id").replace("B","")]);
$("#AdTitle a").html(title[$(this).attr("id").replace("B","")]);
$("#AdDescription a").html(description[$(this).attr("id").replace("B","")]);
$("#Images a").attr("href",imgLink[$(this).attr("id").replace("B","")]);
}else{
$(this).removeClass("active");
$(this).attr("class","Menu_Off");
}
});
window.clearInterval(theTimer);
showImage();
});
$("#Buttons div").mouseover(function(){
if($(this).attr("id") != "Top"){
$(this).css("cursor","pointer");
}
if($(this).attr("class") == "Menu_Off"){
$(this).attr("class","Menu_On");
}
});
$("#Buttons div").mouseout(function(){
if($(this).attr("class") == "Menu_On"){
$(this).attr("class","Menu_Off");
}
});

showImage();
});

然后是CSS部分: 
復(fù)制代碼 代碼如下:

body{
margin:0px;
padding:0px;
background-color:#FFFFFF;
}
table,th,tr,td,div,span,p{
font-size:9pt;
}
a:link{
color:#FFFFFF;
text-decoration:none;
}
a:visited{
color:#FFFFFF;
text-decoration:none;
}
a:active{
color:#FFFFFF;
text-decoration:none;
}
a:hover{
color:#FF0000;
text-decoration:none;
}
#Images{
position:relative;
width:304px;
height:270px;
border:1px #b6cae3 solid;
background-color:#FFFFFF;
}
#Titles{
width:100%;
height:73px;
right:0px;
bottom:0px;
background-color:#000000;
filter:alpha(opacity=40);
}
.Menu_On{
float:right;
width:15px;
height:18px;
background-color:#000000;
margin-left:2px;
line-height:20px;
color:#FF0000;
}
.Menu_Off{
float:right;
width:15px;
height:18px;
background-color:#000000;
margin-left:2px;
line-height:20px;
color:#FFFFFF;
}
#Top{
float:right;
width:47px;
height:18px;
background-color:#000000;
filter:alpha(opacity=40,finishopacity=100,style=1,startx=0px,starty=18px,finishx=47px,finishy=18px);
}
#AdTitle{
padding-top:10px;
padding-bottom:6px;
font-weight:bold;
color:#FFFFFF;
font-size:18px;
padding-left:10px;
}
#AdDescription{
color:#FFFFFF;
padding-left:10px;
}

最后是HTML部分: 
復(fù)制代碼 代碼如下:

<div id="Images">
<a href="ceshi1.asp" target="_blank"><img src="Images/ceshi.jpg" border="0" id="AdImage" /></a>
<div style="position:absolute; right:0px; bottom:0px; height:73px; width:100%;">
<div id="Titles">
<div style="position:absolute; width:100%; height:73px;">
<div id="AdTitle"><a href="ceshi1.asp" target="_blank">測試一下1</a></div>
<div id="AdDescription"><a href="ceshi1.asp" target="_blank">描述一下1</a></div>
<div id="Buttons" style="position:absolute; right:0px; bottom:0px; height:18px; width:100%;" align="right">
<div id="B7" align="center" class="Menu_Off">7</div>
<div id="B6" align="center" class="Menu_Off">6</div>
<div id="B5" align="center" class="Menu_Off">5</div>
<div id="B4" align="center" class="Menu_Off">4</div>
<div id="B3" align="center" class="Menu_Off">3</div>
<div id="B2" align="center" class="Menu_Off">2</div>
<div id="B1" align="center" class="Menu_On active">1</div>
<div id="Top"></div>
</div>
</div>
</div>
</div>
</div>

相關(guān)文章

  • jquery對象和DOM對象的區(qū)別介紹

    jquery對象和DOM對象的區(qū)別介紹

    jquery對象和DOM對象在使用過程很頻繁,正是因為如此,好多朋友都不知道它們之間有什么區(qū)別,下面為大家詳細介紹下,希望對大家有所幫助
    2013-08-08
  • jquery.idTabs 選項卡使用示例代碼

    jquery.idTabs 選項卡使用示例代碼

    idTabs是基于Jquery編寫封裝的一個插件,主要用于實現(xiàn)選項卡功能,下面是它的具體使用
    2014-09-09
  • 讀jQuery之五(取DOM元素)

    讀jQuery之五(取DOM元素)

    使用過Prototype.js的同學(xué)知道$(xx)調(diào)用后返回的是HTMLElement或其集合。
    2011-06-06
  • jquery選擇器簡述

    jquery選擇器簡述

    本篇文章主要是對jQuery選擇器進行了總結(jié)介紹,需要的朋友可以過來參考下,希望對大家有所幫助
    2015-08-08
  • jQuery輪播圖功能制作方法詳解

    jQuery輪播圖功能制作方法詳解

    這篇文章主要介紹了jQuery輪播圖功能制作方法,結(jié)合實例形式詳細分析了jQuery輪播圖實現(xiàn)原理、步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2019-12-12
  • JQUERY設(shè)置IFRAME的SRC值的代碼

    JQUERY設(shè)置IFRAME的SRC值的代碼

    有時候需要設(shè)置iframe的src屬性,下面是基于jquery的實現(xiàn)代碼。
    2010-11-11
  • jQuery內(nèi)容過濾選擇器用法分析

    jQuery內(nèi)容過濾選擇器用法分析

    這篇文章主要介紹了jQuery內(nèi)容過濾選擇器用法,實例分析了:contains()、:has()、:empty()、:parent等內(nèi)容過濾選擇器的使用技巧,需要的朋友可以參考下
    2015-02-02
  • jQuery function的正確書寫方法

    jQuery function的正確書寫方法

    jQuery function想必大家都不會陌生,web前端開發(fā)人員經(jīng)常會接觸到,下面為大家介紹下它的正確書寫方法,感興趣的朋友可以參考下
    2013-08-08
  • jQuery mobile轉(zhuǎn)換url地址及獲取url中目錄部分的方法

    jQuery mobile轉(zhuǎn)換url地址及獲取url中目錄部分的方法

    這篇文章主要介紹了jQuery mobile轉(zhuǎn)換url地址及獲取url中目錄部分的方法,轉(zhuǎn)換url地址本文中介紹的是將相對url轉(zhuǎn)化為絕對url,需要的朋友可以參考下
    2015-12-12
  • jQuery提示效果代碼分享

    jQuery提示效果代碼分享

    這里給大家分享幾段JQuery提示效果的代碼,非常的簡單實用,有需要的小伙伴直接拿走吧
    2014-11-11

最新評論