⑴ 求JQUERY的图片左右轮播的代码,要简单一点的谢谢
首先要定义一个索引来表示你当前轮播到第几张图片了
然后获得你总共有几张图片 当索引跳到最后一张的时候 将其值改为0 即可
对于上一页下一页 逻辑与上面相同
如果当前索引为0 或者为最后一个隐藏掉这个按钮或者赋值另一端的极值
轮播的话 写一个定时器 第一个参数就是这个函数啦 第二个参数给1000(ms)
函数里面就对这个index按上面的逻辑操作即可了
思路给你了 自己写吧。。边查边写 收获会很大
⑵ 简单的HTML+js图片轮播
h5代码:
<div id="wrap">
<ul id="list">
<li>10</li>
<li>9</li>
<li>8</li>
<li>7</li>
<li>6</li>
<li>5</li>
<li>4</li>
<li>3</li>
<li>2</li>
<li>1</li>
</ul>
</div>
css代码:
<style type="text/css">
@-webkit-keyframes move{
0%{left:-500px;}
100%{left:0;}
}
#wrap{width:600px;height:130px;border:1px solid #000;position:relative;margin:100px auto;
overflow: hidden;}
#list{position:absolute;left:0;top:0;padding:0;margin:0;
-webkit-animation:5s move infinite linear;width:200%;}
#list li{list-style:none;width:120px;height:130px;border:1px solid red;background: pink;
color:#fff;text-align: center;float:left;font:normal 50px/2.5em '微软雅黑';}
#wrap:hover #list{-webkit-animation-play-state:paused;}
</style>
(2)简单的图片轮播代码扩展阅读:
轮播图就是一种网站在介绍自己的主打产品或重要信息的传播方式。说的简单点就是将承载着重要信息的几张图片,在网页的某一部位进行轮流的呈现,从而做到让浏览者很快的了解到网站想要表达的主要信息。以及各种新闻网站的头版头条都是用这种方式呈现的重要信息。
轮播图的实现方式:例如:有5张轮播的图片,每张图片的宽度为1024px、高度为512px.那么轮播的窗口大小就应该为一张图片的尺寸,即为:1024×512。之后将这5张图片0px水平相接组成一张宽度为:5120px,高度依然为:512px。最后将这张合成后的大图每次向左移动1024px即可实现轮播图。
⑶ HTML图片轮播代码怎么写
(1)<div id="butong_net_left" style="overflow:hidden;width:1000px。
(2)"> <table cellpadding="0" cellspacing="0" border="0"> <tr><td id="butong_net_left1" valign="top" align="center"> <table cellpadding="2" cellspacing="0" border="0"> <tr align="center">
⑷ HTML图片轮播代码怎么写
html部分
<divid="container">
<divclass="sections">
<divclass="section"id="section0"><h3>thisisthepage1</h3></div>
<divclass="section"id="section1"><h3>thisisthepage2</h3></div>
<divclass="section"id="section2"><h3>thisisthepage3</h3></div>
<divclass="section"id="section3"><h3>thisisthepage4</h3></div>
</div>
</div>
css部分
*{
padding:0;
margin:0;
}
html,body{
height:100%;
}
#container{
width:100%;
height:500px;
overflow:hidden;
}
.sections,.section{
height:100%;
}
#container,.sections{
position:relative;
}
.section{
background-color:#000;
background-size:cover;
background-position:50%50%;
text-align:center;
color:white;
}
#section0{
background-image:url('images/1.jpg');
}
#section1{
background-image:url('images/2.jpg');
}
#section2{
background-image:url('images/3.jpg');
}
#section3{
background-image:url('images/4.jpg');
}
.pagesli{list-style-type:none;width:10px;height:10px;border-radius:10px;background-color:white}.pagesli:hover{box-shadow:005px2pxwhite}.pagesli.active{background-color:orange;box-shadow:005px2pxorange}.pages{position:absolute;z-index:999}.pages.horizontal{left:50%;transform:translateX(-50%);bottom:5px}.pages.horizontalli{display:inline-block;margin-right:10px}.pages.horizontalli:last-child{margin-right:0}.pages.vertical{right:5px;top:50%;transform:translateY(-50%)}.pages.verticalli{margin-bottom:10px}.pages.verticalli:last-child{margin-bottom:0}
JS部分
<scriptsrc="js/jquery-1.11.0.min.js"type="text/javascript"></script>
//引入pageSwitch.min.js
<script>
$("#container").PageSwitch({
direction:'horizontal',
easing:'ease-in',
ration:1000,
autoPlay:true,
loop:'false'
});
</script>
⑸ 求图片轮播代码
<SCRIPT language=JavaScript>
<!--
function objSP_Article() {this.ImgUrl=""; this.LinkUrl=""; this.Title="";}
function SlidePic_Article(_id) {this.ID=_id; this.Width=0;this.Height=0; this.TimeOut=5000; this.Effect=23; this.TitleLen=0; this.PicNum=-1; this.Img=null; this.Url=null; this.Title=null; this.AllPic=new Array(); this.Add=SlidePic_Article_Add; this.Show=SlidePic_Article_Show; this.LoopShow=SlidePic_Article_LoopShow;}
function SlidePic_Article_Add(_SP) {this.AllPic[this.AllPic.length] = _SP;}
function SlidePic_Article_Show() {
if(this.AllPic[0] == null) return false;
document.write("<div align='center'><a id='Url_" + this.ID + "' href='' target='_blank'><img id='Img_" + this.ID + "' style='width:" + this.Width + "px; height:" + this.Height + "px; filter: revealTrans(ration=2,transition=23);' src='javascript:null' border='0'></a>");
if(this.TitleLen != 0) {document.write("<br><span id='Title_" + this.ID + "'></span></div>");}
else{document.write("</div>");}
this.Img = document.getElementById("Img_" + this.ID);
this.Url = document.getElementById("Url_" + this.ID);
this.Title = document.getElementById("Title_" + this.ID);
this.LoopShow();
}
function SlidePic_Article_LoopShow() {
if(this.PicNum<this.AllPic.length-1) this.PicNum++ ;
else this.PicNum=0;
this.Img.filters.revealTrans.Transition=this.Effect;
this.Img.filters.revealTrans.apply();
this.Img.src=this.AllPic[this.PicNum].ImgUrl;
this.Img.filters.revealTrans.play();
this.Url.href=this.AllPic[this.PicNum].LinkUrl;
if(this.Title) this.Title.innerHTML="<a href="+this.AllPic[this.PicNum].LinkUrl+" target='_blank'>"+this.AllPic[this.PicNum].Title+"</a>";
this.Img.timer=setTimeout(this.ID+".LoopShow()",this.TimeOut);
}
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
var SlidePic_256 = new SlidePic_Article("SlidePic_256");
SlidePic_256.Width = 530;
SlidePic_256.Height = 350;
SlidePic_256.TimeOut = 5000;
SlidePic_256.Effect = 23;
SlidePic_256.TitleLen = 0;
var oSP = new objSP_Article();
oSP.ImgUrl = "http://www.ptycrc.com/img/personLeftreg.gif";
oSP.LinkUrl = "http://www.ptycrc.com/userreg.asp";
oSP.Title = " ";
SlidePic_256.Add(oSP);
var oSP = new objSP_Article();
oSP.ImgUrl = "http://www.ptycrc.com/img/companyLeftreg.gif";
oSP.LinkUrl = "http://www.ptycrc.com/com_reg.asp";
oSP.Title = " ";
SlidePic_256.Add(oSP);
var oSP = new objSP_Article();
oSP.ImgUrl = "http://www.ptycrc.com/img/logo.png";
oSP.LinkUrl = "http://www.ptycrc.com";
oSP.Title = " ";
SlidePic_256.Add(oSP);
//-->
</SCRIPT>
⑹ 求CSS图片轮播完整代码
以4张图片为例:
1.基本布局:
将4张图片左浮动横向并排放入一个div容器内,图片设置统一尺寸,div宽度设置4个图片的总尺寸,然后放入相框容器div,
相框设置1个图片的大小并设置溢出隐藏,以保证正确显示一个照片。
2.设置动画:
然后使用css3动画,通过对photos进行位移,从而达到显示不同的图片,每次偏移一个图片的宽度,即可显示下一张图片。
4张图片,需要切换3次.
根据需要可以对各个图片添加相应的序号和图片简介。
3.代码如下:
复制代码
1 <style>
2 #frame{position:absolute;width:300px;height:200px;overflow:hidden;border-radius:5px}
3 #dis{position:absolute;left:-50px;top:-10px;opacity:.5}
4 #dis li{display:inline-block;width:200px;height:20px;margin:0 50px;float:left;text-align:center;color:#fff;border-radius:10px;background:#000}
5 #photos img{float:left;width:300px;height:200px}
6 #photos { position: absolute;z-index:9; width: calc(300px * 4);/*---修改图片数量的话需要修改下面的动画参数*/ }
7 .play{ animation: ma 20s ease-out infinite alternate;}
8 @keyframes ma {
9 0%,25% { margin-left: 0px; }
10 30%,50% { margin-left: -300px; }
11 55%,75% { margin-left: -600px; }
12 80%,100% { margin-left: -900px; }
13
14 }
15 </style>
复制代码
复制代码
<div id="frame" >
<div id="photos" class="play">
<img src="images/1.jpg" >
<img src="images/3.jpg" >
<img src="images/4.jpg" >
<img src="images/5.jpg" >
<ul id="dis">
<li>www.scxhdzs.com#www.scxhdzs.com#111</li>
<li>22222222222222</li>
<li>33333333333333</li>
<li>44444444444444</li>
</ul>
</div>
</div>
拿走不谢!
⑺ jquery简单自动轮播图代码怎么写
html部分 this is the page一 this is the page二 this is the page三 this is the page四 css部分 *{ padding: 0; margin: 0; } html,body{ height: 一00%; } #container { width: 一00%; height: 500px; overflow: hidden; } .sections,.section { height:一00%; } #container,.sections { position: relative; } .section { background-color: #000; background-size: cover; background-position: 50% 50%; text-align: center; color: white; } #section0 { background-image: url('images/一.jpg'); } #section一 { background-image: url('images/二.jpg'); } #section二 { background-image: url('images/三.jpg'); } #section三 { background-image: url('images/四.jpg'); } .pages li{list-style-type:none;width:一0px;height:一0px;border-radius:一0px;background-color:white}.pages li:hover{box-shadow:0 0 5px 二px white}.pages li.active{background-color:orange;box-shadow:0 0 5px 二px orange}.pages{position:absolute;z-index:999}.pages.horizontal{left:50%;transform:translateX(-50%);bottom:5px}.pages.horizontal li{display:inline-block;margin-right:一0px}.pages.horizontal li:last-child{margin-right:0}.pages.vertical{right:5px;top:50%;transform:translateY(-50%)}.pages.vertical li{margin-bottom:一0px}.pages.vertical li:last-child{margin-bottom:0} JS部分 jquery-一.一一.0.min.js" type="text/javascript"> //引入pageSwitch.min.js 如
⑻ dw图片轮播代码是什么
html部分:
<div id="box" onmouseover="stop()" onmouseout="start()">
<div id="red" class="slide"></div>
<div id="green" class="slide"></div>
<div id="blue" class="slide"></div>
</div>
css部分:
#box{
width:100px;
height:100px;
border:1px solid black;
position:relative;
}
.slide{
width:100px;
height:100px;
position:absolute;
}
#box{
width:100px;
height:100px;
border:1px solid black;
position:relative;
overflow:hidden;
}
JS部分:
onload=function(){
var arr = document.getElementsByClassName("slide");
for(var i=0;i<arr.length;i++){
arr[i].style.left = i*100+"px";
}
}
function LeftMove(){
var arr = document.getElementsByClassName("slide");
for(var i=0;i<arr.length;i++){
var left = parseFloat(arr[i].style.left);
left-=2;
var width = 100;//图片的宽度
if(left<=-width){
left=(arr.length-1)*width;//当图片完全走出显示框,拼接到末尾
}
arr[i].style.left = left+"px";
}
}
moveId=setInterval(LeftMove,10);//设置一个10毫秒定时器,并给自己取名
if(left<=-width){
left=(arr.length-1)*width;//当图片完全走出显示框,拼接到末尾
clearInterval(moveId);
}
function divInterval(){
moveId=setInterval(LeftMove,10);//设置一个10毫秒定时器
}
timeId=setInterval(divInterval,3000);//设置一个3秒的定时器。
function stop(){
clearInterval(timeId);//鼠标停留关闭B定时器
}
function start(){
clearInterval(timeId);//重新打开一个定时前,先关闭之前定时器。
timeId=setInterval(divInterval,2000);//重启一个定时器
}
//页面失去焦点定时器停止
onblur = function(){
stop();
}
//页面获取焦点时重启定时器
onfocus = function(){
start();
}
(8)简单的图片轮播代码扩展阅读:
代码解析:
为整个页面添加onload加载完成事件,当浏览器打开并加载完并自动执行事件中的代码块。这部分js代码写在刚才css下面即可,保持同级结构。
当页面加载完全,三个div应该并列在一起。
接下来,需要实现将这三个div整体向左移动,使用定时器,即前面的定时器A。
为了解决当鼠标悬停在轮播图,轮播图停止轮播效果,需要在box上添加鼠标移入和移出事件。
当浏览器窗口切出或页面切换到其他页面一段时间再回来时,轮播效果会有短暂加速(随切出时间加长而加长)。
主要是因为虽然窗口切出去了,定时器依然在执行,但页面却没有将效果显示,所以切回来后会将之前的效果显示出来而加速轮播图。所以添加页面焦点事件。