当前位置:首页 > 代码 > 正文

html5切换焦点图代码(网页设计焦点图代码)

admin 发布:2022-12-19 18:20 114


本篇文章给大家谈谈html5切换焦点图代码,以及网页设计焦点图代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

html5 css3 如何使页面中显示的图片自动切换的问题

基本原理参见如下代码在IE8中效果,样式根本没有起作用。 html head ...可以通过js或其他方法曲线的实现html5 css3的问题。 或者尽你自己的一份力...

图片切换代码(html)网页

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""

html xmlns=""

head

meta http-equiv="Content-Type" content="text/html; charset=utf-8" /

titleqweq/title

link href="css/om_system.css" rel="stylesheet" type="text/css" /

script type="text/javascript" src="js/jquery-1.9.1.min.js"/script

style type="text/css"

.banner{

width: 1000px;

margin: 50px auto 0 auto;

height: 500px;

position: relative;

}

.banner img{

width: 100%

}

.banner ul{

height: 100%;

overflow:hidden;

}

.banner li{

display: none;

height: 100%;

overflow: hidden;

}

.banner li.on{

display: block;

}

.banner-btn{

width: 700px;

position: absolute;

left: 150px;

top: 200px;

}

.banner-btn button{

border: none;

background:none;

}

.pic-left{

float: left;

}

.pic-right{

float: right;

}

/style

/head

body class="body-bg"

div class="banner"

ul

li class="on"img src="images/4.jpg"/li

liimg src="images/5.jpg"/li

liimg src="images/6.jpg"/li

/ul

div class="banner-btn clear"

button class="pic-left"img src="images/arrow-3-l.png"/button

button class="pic-right"img src="images/arrow-3-r.png"/button

/div

/div

input value="dd" id="dd" /

script type="text/javascript"

$(function(){

$('.pic-left').click(function(){

var index=$('li.on').index();

var nextindex=(index+2)%3;

// alert(nextindex)

$("#dd").val(nextindex);

$('li.on').fadeOut(200,function(){

$('li.on').removeClass('on');

$('.banner li').eq(nextindex).addClass('on')

});

setTimeout(function(){$('.banner li').eq(nextindex).fadeIn(200)},200);

});

$('.pic-right').click(function(){

var index=$('li.on').index();

var nextindex=(index+1)%3;

// alert(nextindex)

$("#dd").val(nextindex);

$('li.on').fadeOut(200,function(){

$('li.on').removeClass('on');

$('.banner li').eq(nextindex).addClass('on')

});

setTimeout(function(){$('.banner li').eq(nextindex).fadeIn(200)},200);

});

});

/script

/body

/html

图片自己替换下,原理其实很简单:这边是通过ul li上加一个class='on',做标记(即当前显示),然后通过这个on来遍历下一个元素

高分悬赏计算机达人,求图片切换代码

下面是代码,换图修改

//slideimages数组为变换的图

var slideimages=new Array();

slideimages[0]="images/ad-01.jpg";

slideimages[1]="images/ad-02.jpg";

slideimages[2]="images/ad-03.jpg";

slideimages[3]="images/ad-04.jpg";

slideimages[4]="images/ad-05.jpg";

文字修改

//slidetext数组为变换的文字

var slidetext=new Array();

slidetext[0]="焦点图片广告011111";

slidetext[1]="焦点图片广告022222";

slidetext[2]="焦点图片广告033333";

slidetext[3]="焦点图片广告044444";

slidetext[4]="焦点图片广告055555";

链接修改

//slidetext数组为点击大图后跳到的地址

var slidelinks=new Array();

slidelinks[0]="";

slidelinks[1]="";

slidelinks[2]="";

slidelinks[3]="";

slidelinks[4]="";

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

!-- saved from url=(0055) --

HTMLHEADTITLE无标题文档/TITLE

META http-equiv=Content-Type content="text/html; charset=gb2312"

STYLE type=text/cssBODY {

TEXT-ALIGN: center

}

TD {

FONT-SIZE: 12px

}

#textslide {

COLOR: #333333

}

/STYLE

META content="MSHTML 6.00.6000.16825" name=GENERATOR/HEAD

BODY

TABLE cellSpacing=0 cellPadding=0 width=325 border=0

TBODY

TR vAlign=top

TD colSpan=3A onmouseover=tu_ove() style="CURSOR: hand"

onclick=gotoshow() onmouseout=ou()IMG height=190 src="images/ad-01.jpg"

width=325 border=0 name=slide/A/TD/TR

TR

TD class=white align=middle width=229 bgColor=#f4f4f4 height=19/TD

TD width=1 bgColor=#7c7c7c

DIV style="POSITION: relative"

DIV style="POSITION: absolute; TOP: 10px"

TABLE cellSpacing=0 cellPadding=0 width=95 border=0

TBODY

TR vAlign=top align=middle

TD width=19 height=0

DIV style="POSITION: relative"

DIV id=xiaotu1

style="LEFT: 0px; POSITION: absolute; TOP: -19px"IMG id=xiaosan1

height=3 src="images/bian1.gif" width=10 border=0/DIV/DIV/TD

TD width=19 height=0

DIV style="POSITION: relative"

DIV id=xiaotu2

style="LEFT: 0px; POSITION: absolute; TOP: -19px"IMG id=xiaosan2

height=3 src="images/bian1.gif" width=10/DIV/DIV/TD

TD width=19 height=0

DIV style="POSITION: relative"

DIV id=xiaotu3

style="LEFT: 0px; POSITION: absolute; TOP: -19px"IMG id=xiaosan3

height=3 src="images/bian1.gif" width=10/DIV/DIV/TD

TD width=19 height=0

DIV style="POSITION: relative"

DIV id=xiaotu4

style="LEFT: 0px; POSITION: absolute; TOP: -19px"IMG id=xiaosan4

height=3 src="images/bian1.gif" width=10/DIV/DIV/TD

TD width=19 height=0

DIV style="LEFT: 1px; POSITION: relative"

DIV id=xiaotu5

style="LEFT: 0px; POSITION: absolute; TOP: -19px"IMG id=xiaosan5

height=3 src="images/bian1.gif"

width=10/DIV/DIV/TD/TR/TBODY/TABLE/DIV/DIV/TD

TD width=95 height=19

TABLE cellSpacing=0 cellPadding=0 width=95 border=0

TBODY

TR vAlign=top

TD class=homejdboder width=19 height=19A onmouseover=ove(0)

style="CURSOR: hand" onmouseout=ou()IMG height=19

src="images/1.gif" width=19 border=0/A/TD

TD class=homejdboder width=19 height=19A onmouseover=ove(1)

style="CURSOR: hand" onmouseout=ou()IMG height=19

src="images/2.gif" width=19 border=0/A/TD

TD class=homejdboder width=19 height=19A onmouseover=ove(2)

style="CURSOR: hand" onmouseout=ou()IMG height=19

src="images/3.gif" width=19 border=0/A/TD

TD class=homejdboder width=19 height=19A onmouseover=ove(3)

style="CURSOR: hand" onmouseout=ou()IMG height=19

src="images/4.gif" width=19 border=0/A/TD

TD width=19 height=19A onmouseover=ove(4) style="CURSOR: hand"

onmouseout=ou()IMG height=19 src="images/5.gif" width=19

border=0/A/TD/TR/TBODY/TABLE/TD/TRtrtd colspan="3"

DIV id=textslide焦点图标题层/DIV/td/tr/TBODY/TABLE

SCRIPT

//slideimages数组为变换的图

var slideimages=new Array();

slideimages[0]="images/ad-01.jpg";

slideimages[1]="images/ad-02.jpg";

slideimages[2]="images/ad-03.jpg";

slideimages[3]="images/ad-04.jpg";

slideimages[4]="images/ad-05.jpg";

//slidetext数组为变换的文字

var slidetext=new Array();

slidetext[0]="焦点图片广告011111";

slidetext[1]="焦点图片广告022222";

slidetext[2]="焦点图片广告033333";

slidetext[3]="焦点图片广告044444";

slidetext[4]="焦点图片广告055555";

//slidetext数组为点击大图后跳到的地址

var slidelinks=new Array();

slidelinks[0]="";

slidelinks[1]="";

slidelinks[2]="";

slidelinks[3]="";

slidelinks[4]="";

//焦点图初始内容--start

var slidespeed=3000

var slidesanjiaoimages=new Array("images/bian2.gif","images/bian1.gif");

var slidesanjiaoimagesname=new Array("xiaosan1","xiaosan2","xiaosan3","xiaosan4","xiaosan5");

var filterArray=new Array();

filterArray[0]="progid:DXImageTransform.Microsoft.Pixelate (enabled=false,duration=2,maxSquare=25 )";

filterArray[1]="progid:DXImageTransform.Microsoft.Stretch (duration=1,stretchStyle=PUSH)";

filterArray[2]="progid:DXImageTransform.Microsoft.Stretch(duration=1)";

filterArray[3]="progid:DXImageTransform.Microsoft.Slide(bands=8, duration=1)";

filterArray[4]="progid:DXImageTransform.Microsoft.Fade ( duration=1,overlap=0.25 )";

var imageholder=new Array()

var ie55=window.createPopup

for (i=0;islideimages.length;i++){

imageholder[i]=new Image()

imageholder[i].src=slideimages[i]

}

function tu_ove(){clearTimeout(setID)}

function ou(){slideit()}

var whichlink=0

var whichimage=0

function gotoshow(){

window.open(slidelinks[whichlink]);

}

function slideit(){

document.images.slide.style.filter=filterArray[whichimage];

//alert(document.images.slide.style.filter);

pixeldelay=(ie55)? (document.images.slide.filters[0].duration*1000) : 0

//alert(pixeldelay);

if (!document.images) return

if (ie55) {

document.images.slide.filters[0].apply();

document.images.slide.filters[0].play();

}

document.images.slide.src=imageholder[whichimage].src

document.getElementById("textslide").innerText=slidetext[whichimage];

document.getElementById("xiaosan1").src=slidesanjiaoimages[0];

document.getElementById("xiaosan2").src=slidesanjiaoimages[0];

document.getElementById("xiaosan3").src=slidesanjiaoimages[0];

document.getElementById("xiaosan4").src=slidesanjiaoimages[0];

document.getElementById("xiaosan5").src=slidesanjiaoimages[0];

document.getElementById(slidesanjiaoimagesname[whichimage]).src=slidesanjiaoimages[1];

if (ie55) document.images.slide.filters[0].play()

whichlink=whichimage

whichimage=(whichimageslideimages.length-1)? whichimage+1 : 0

setID=setTimeout("slideit()",slidespeed+pixeldelay)

}

slideit()

function ove(n){

clearTimeout(setID)

whichimage=n;

document.images.slide.src=imageholder[whichimage].src

document.getElementById("textslide").innerText=slidetext[whichimage];

document.getElementById("xiaosan1").src=slidesanjiaoimages[0];

document.getElementById("xiaosan2").src=slidesanjiaoimages[0];

document.getElementById("xiaosan3").src=slidesanjiaoimages[0];

document.getElementById("xiaosan4").src=slidesanjiaoimages[0];

document.getElementById("xiaosan5").src=slidesanjiaoimages[0];

document.getElementById(slidesanjiaoimagesname[whichimage]).src=slidesanjiaoimages[1];

}

/SCRIPT

/BODY/HTML

网页在淘宝怎么做出鼠标移动切换图片的效果?

切换图片效果:html代码:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""

html xmlns=""

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title布丁移动官网jQuery焦点图/title

link href="styles/zzsc.css" rel="stylesheet" type="text/css" /

/head

body

br

div id="focus"

div id="slides"

style type="text/css"

ul.pagination{width:55px !important;}

/style

div class="slides_container"

a href="i_weiche.html" title="微车" rel="external"

img src="images/focus/weiche_banner.png" alt="微车" //a

a href="i_ticket.html" title="布丁电影票" rel="external"

img src="images/focus/ticket_banner.png" alt="布丁电影票" //a

a href="i_coupon.html" title="布丁优惠券" rel="external"

img src="images/focus/coupon.jpg" alt="布丁优惠券" //a

/div

/div

/div

script src="scripts/jquery.min_v1.0.js" type="text/javascript"/script

script src="scripts/slides.min.jquery_v1.0.js" type="text/javascript"/script

script type="text/javascript"

$(function(){

$('#slides').slides({

preload: true,

preloadImage: 'images/loading.gif',

play: 5000,

pause: 2500,

hoverPause: true,

fadeSpeed: 350,

effect: 'fade'

});

});

/script

div style="text-align:center;clear:both"

/div

/body

/html

css代码:

@charset "utf-8";

/*通用样式*/

html, body, div, img, ul, ol, li, dl, dt, dd, a, span, h1, h2, h3, h4, h5, h6, p, span {

margin: 0;

padding: 0;

}

*html{

background-image: url(about:blank);

background-attachment: fixed;

}

body {

background: url(../images/body_bg.jpg);

font: 14px "微软雅黑", "宋体", "黑体";

}

a {

text-decoration: none;

}

a:hover {

text-decoration: underline;

}

img {

border: 0 none!important;

}

ul, li {

list-style: none;

}

#wrap {

background: url(../images/wrap_bg.jpg);

border-bottom: 1px solid #c3c3c3;

box-shadow: 0 3px 20px #d2d2d2;

position: relative;

width: 100%;

display: table;

}

/*焦点图切换*/

#focus {

width: 1000px;

height: 466px;

margin: 0 auto;

background: url(../images/loading.png) no-repeat 48% 37%;

}

#slides {

position: absolute;

z-index: 1;

}

.slides_container {

width: 1000px;

overflow: hidden;

position: relative;

display: none;

}

.slides_container a {

width: 1000px;

height: 466px;

display: block;

}

.pagination {

position: absolute;

bottom: -8px;

z-index: 999;

padding: 0 10px;

padding-top: 3px;

margin-left: 47%;

background: rgba(255,255,255,0.5);

box-shadow: 0 0 10px #ccc inset;

border-radius: 10px;

width: 72px;

height: 14px;

}

.pagination li {

float: left;

margin: 0 4px;

}

.pagination li a {

display: block;

width: 10px;

height: 0;

padding-top: 10px;

background: url(../images/pagination_1.png) 0 0;

float: left;

overflow: hidden;

}

.pagination li.current a {

background-position: 0 -10px;

_background-position: 0 -9px;

}

/*内容*/

#column_ab_a {

width: 100%;

overflow: hidden;

float: left;

padding: 60px 30px 20px;

}

#column_ab_b {

width: 300px;

overflow: hidden;

float: right;

}

/*#column_ab_a*/

#column_ab_a div {

width: 250px;

float: left;

overflow: hidden;

color: #a1a1a1;

margin: 0 30px;

display: inline;

}

#column_ab_a div h2 {

font-size: 16px;

color: #4d4d4d;

padding-left: 50px;

height: 40px;

}

#column_ab_a div#coupon h2 {

background: url(../images/coupon_h2.jpg) no-repeat left center;

}

#column_ab_a div#ticket h2 {

background: url(../images/ticket_h2.jpg) no-repeat left center;

}

#column_ab_a div h2 span {

font-size: 14px;

font-weight: normal;

color: #a1a1a1;

display: block;

background: none;

}

#column_ab_a div p {

font-size: 14px;

margin-top: 20px;

margin-bottom: 20px;

line-height: 24px;

text-indent: 2em;

}

#column_ab_a div p a {

color: #ee4017;

background: url(../images/more.png) no-repeat right center;

padding-right: 10px;

margin-left: 10px;

}

#column_ab_a div p a:hover {

text-decoration: underline;

}

#column_ab_a div h3,

#column_ab_a div h4 {

text-align: right;

}

#column_ab_a div h3 {

margin-top: 5px;

}

/*#column_ab_b*/

#column_ab_b div {

width: 219px;

overflow: hidden;

color: #a1a1a1;

border-left: 1px solid #cecece;

margin-top: 60px;

padding: 0 40px;

}

#column_ab_b div h2 {

font-size: 16px;

color: #4d4d4d;

background: url(../images/system_h2.jpg) no-repeat left center;

padding-left: 50px;

height: 40px;

}

#column_ab_b div h2 span {

font-size: 14px;

font-weight: normal;

color: #a1a1a1;

display: block;

background: none;

}

#column_ab_b div dl {

margin-top: 20px;

line-height: 24px;

}

#column_ab_b div dt {

color: #4d4d4d;

font-weight: bold;

background: url(../images/dot1.png) no-repeat left center;

padding-left: 15px;

}

#column_ab_b div dd {

padding-left: 15px;

margin-bottom: 10px;

}

#column_ab_b div a {

display: block;

width: 161px;

height: 44px;

background: url(../images/tosystem.jpg);

text-indent: -9999px;

margin: 20px auto;

}

#sbuding {

display: block;

width: 161px;

height: 44px;

background: url(../images/tosystem.jpg);

text-indent: -9999px;

margin-left:60px;

}

切换图片无论在淘宝网页上还是一般的网站上都是非常的常见的一个效果。实现的方法也有多种。只要灵活运用就行。不难。

用html如何实现点击按钮变换按钮的样式?

html页面如下:

 

div class="wrapper" 

div id="focus" 

ul 

lia href="" target="_blank"img src="img/01.jpg" alt="QQ商城焦点图效果下载" //a/li 

lia href="" target="_blank"img src="img/02.jpg" alt="QQ商城焦点图效果教程" //a/li 

lia href="" target="_blank"img src="img/03.jpg" alt="jquery商城焦点图效果" //a/li 

lia href="" target="_blank"img src="img/04.jpg" alt="jquery商城焦点图代码" //a/li 

lia href="" target="_blank"img src="img/05.jpg" alt="jquery商城焦点图源码" //a/li 

/ul 

/div 

/div!-- wrapper end -- 

/body

css样式:

 

style type="text/css" 

* {margin:0; padding:0;} 

body {font-size:12px; color:#222; font-family:Verdana,Arial,Helvetica,sans-serif; background:#f0f0f0;} 

.clearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;} 

.clearfix {zoom:1;} 

ul,li {list-style:none;} 

img {border:0;} 

.wrapper {width:800px; margin:0 auto; padding-bottom:50px;} 

/* qqshop focus */ 

#focus {width:800px; height:280px; overflow:hidden; position:relative;} 

#focus ul {height:380px; position:absolute;} 

#focus ul li {float:left; width:800px; height:280px; overflow:hidden; position:relative; background:#000;} 

#focus ul li div {position:absolute; overflow:hidden;} 

#focus .btnBg {position:absolute; width:800px; height:20px; left:0; bottom:0; background:#000;} 

#focus .btn {position:absolute; width:780px; height:10px; padding:5px 10px; right:0; bottom:0; text-align:right;} 

#focus .btn span {display:inline-block; _display:inline; _zoom:1; width:25px; height:10px; _font-size:0; margin-left:5px; cursor:pointer; background:#fff;} 

#focus .btn span.on {background:#fff;} 

#focus .preNext {width:45px; height:100px; position:absolute; top:90px; background:url(img/sprite.png) no-repeat 0 0; cursor:pointer;} 

#focus .pre {left:0;} 

#focus .next {right:0; background-position:right top;} 

/style

关于html5切换焦点图代码和网页设计焦点图代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/17151.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载