⑴ 简单的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</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>
(1)js简单图片轮播图扩展阅读:
轮播图是网站介绍其主要产品或重要信息的一种方式。简单的一点是,在网页的某一部分,会依次呈现几个带有重要信息的图片,这样访问者就可以快速了解网站想要表达的主要信息。各种新闻网站的头版头条也是以这种方式呈现的重要信息。
轮播图的实现方式:例如:有5张轮播的图片,每张图片的宽度为1024px,高度为512px。那么旋转的窗口大小应该是一张图片的大小,即1024×512,然后,将五张0px的图片水平连接,形成一张5120px宽、512px高的图片,最后,通过每次向左移动1024px,可以旋转大的合成图像。
⑵ 怎么用js做一个简单的轮播图
obj1.onmouseover = function () {
clearInterval(time);
}
obj1.onmouseout = function () {
time = setInterval("turn();", 6000);
}
for (var num = 0; num < obj2.length; num++) {
obj2[num].onmouseover = function () {
turn(this.innerHTML);
clearInterval(time);
}
obj2[num].onmouseout = function () {
time = setInterval("turn();", 6000);
}
}
⑶ 简单的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>
(3)js简单图片轮播图扩展阅读:
轮播图就是一种网站在介绍自己的主打产品或重要信息的传播方式。说的简单点就是将承载着重要信息的几张图片,在网页的某一部位进行轮流的呈现,从而做到让浏览者很快的了解到网站想要表达的主要信息。以及各种新闻网站的头版头条都是用这种方式呈现的重要信息。
轮播图的实现方式:例如:有5张轮播的图片,每张图片的宽度为1024px、高度为512px.那么轮播的窗口大小就应该为一张图片的尺寸,即为:1024×512。之后将这5张图片0px水平相接组成一张宽度为:5120px,高度依然为:512px。最后将这张合成后的大图每次向左移动1024px即可实现轮播图。
⑷ 求用js制作简单的图片轮播效果,三张图片为佳
setInterval(showIMG,1000); //每1000ms执行一次showIMG函数,不明白再追问。
function showIMG(){
//todo 实现图片切换部分
}
⑸ 求一段简单的js图片轮播代码,刚学js,不要太复杂。谢谢!
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="焦点图" />
<meta name="description" content="焦点图代码" />
<title>焦点图</title>
<script type="text/javascript" src="http://www.jinchuwenhua.com/templets/default/js/jquery.js"></script>
<script type="text/javascript" src="http://www.jinchuwenhua.com/templets/default/js/slide.js"></script>
</head>
<body>
<!-- 代码 开始 -->
<style>
.ck-slide ul { margin: 0; padding: 0; list-style-type: none;}
.ck-slide { position: relative; overflow: hidden;}
.ck-slide ul.ck-slide-wrapper { position: absolute; top: 0; left: 0; z-index: 1; margin: 0; padding: 0;}
.ck-slide ul.ck-slide-wrapper li { position: absolute;}
.ck-slide .ck-prev, .ck-slide .ck-next { position: absolute; top: 50%; z-index: 2; width: 35px; height: 70px; margin-top: -35px; border-radius: 3px; opacity: .15; background: red; text-indent: -9999px; background-repeat: no-repeat; transition: opacity .2s linear 0s;}
.ck-slide .ck-prev { left: 5px; background: url(templets/default/images/arrow-left.png) #000 50% no-repeat;}
.ck-slide .ck-next { right: 5px; background: url(templets/default/images/arrow-right.png) #000 50% no-repeat;}
.ck-slidebox { position: absolute; left: 50%; bottom: 0px; z-index: 30; hright:30px;width:100%}
.ck-slidebox ul { height: 30px; padding: 0 4px; background: rgba(0,0,0,0.5); text-align:center}
.ck-slidebox ul li { float: left; height: 30px; margin: 0px 4px;line-height:30px;color:#fff;display:none}
.ck-slidebox ul li em { display: block; width: 100%; height: 30px; cursor: pointer; font-size:14px}
.ck-slidebox ul li.current em {color:#fff }
.ck-slidebox ul li em:hover { }
.ck-slide { width: 600px; height: 400px; margin: 0 auto;}
.ck-slide ul.ck-slide-wrapper { height: 400px;}
.ck-slide-wrapper li {display:none}
.ck-slidebox ul li{display:none}
.current{display:block!important}
</style>
<div class="ck-slide">
<ul class="ck-slide-wrapper">
<li>
<a target="_blank" href="http://www.jinchuwenhua.com/a/xinwen/2015/1014/307.html" target="_blank"><img id="slide-img-1" src="http://www.jinchuwenhua.com/uploads/allimg/151014/1-151014114S60-L.jpg" class="slide" alt="国考明起报名招2.7万人 首次仅面向体制外招录" style='width:600px'/></a>
</li>
<li>
<a target="_blank" href="http://www.jinchuwenhua.com//a/xinwen/2015/1014/289.html" target="_blank"><img id="slide-img-2" src="http://www.jinchuwenhua.com/uploads/151014/1-151014092105J3.jpg" class="slide" alt="中关村“变形记”:从电子卖场到7.2公里的创业大街" style='width:600px'/></a>
</li>
<li>
<a target="_blank" href="http://www.jinchuwenhua.com/a/xinwen/2015/1014/290.html" target="_blank"><img id="slide-img-3" src="http://www.jinchuwenhua.com/uploads/allimg/151014/1-151014092F30-L.jpg" class="slide" alt="金星大聊两性话题 辣评娱乐圈男星:没我想睡的" style='width:600px'/></a>
</li>
</ul>
<a href="javascript:" class="ctrl-slide ck-prev">上一张</a> <a href="javascript:" class="ctrl-slide ck-next">下一张</a>
<div class="ck-slidebox">
<div class="slideWrap">
<ul class="dot-wrap">
<li><em>国考明起报名招2.7万人 首次仅面向体制外招录</em></li>
<li><em>中关村“变形记”:从电子卖场到7.2公里的创业大街</em></li>
<li><em>金星大聊两性话题 辣评娱乐圈男星:没我想睡的</em></li>
</ul>
</div>
</div>
</div>
<!--图片轮播结束-->
<!-- 代码 结束 -->
<script>
$('.ck-slide').ckSlide({
autoPlay: true
});
</script>
</body>
</html>
⑹ JS简单的轮播图,像图片这种怎么做
如果你想要上下同时切换的方法也很简单,只要你定ID的时候有点规律就好了,例如img1和imgs1,function asd(target){
document.getElementById("img"+target).style.display="none";
document.getElementById("imgs"+target).style.display="none";
}
那么只要target传入图片序号如:1;那么就可以实现两张图片同时隐藏显示了;
⑺ 跪求类似图里这样的图片轮播代码,最好是没有js的纯HTML的,越简单的越好
像这种情况,一般情况下都会用到JS的,纯HTML的目前至少以我的能力没有办法写出来!
⑻ 求一个简单的js实现轮播代码
<!DOCTYPEHTML>
<html>
<head>
<title>JS无缝滚动图片</title>
<metacharset=UTF-8/>
<styletype="text/css">
*{
margin:0;
padding:0;
}
#div2{
margin:auto;
width:602px;
overflow:hidden;
left:200px;
}
#div1{
position:relative;
left:0px;
width:1200px;
}
#div1li{
list-style-type:none;
float:left;
width:200px;
height:180px;
}
img{
width:200px;
height:180px;
}
ul#ul1{
position:relative;
}
</style>
<scripttype="text/javascript">
window.onload=function()
{
varoUl=document.getElementById('ul1');
vart,o;
varspeed=0;
varfunny=function()
{
t&&clearInterval(t);
t=setInterval(function()
{
speed-=200/11;
if(speed<-200){
speed=0;
oUl.appendChild(oUl.children[0]);
t&&clearInterval(t);
t=null;
o&&clearTimeout(o);
o=setTimeout(funny,1000);
}
oUl.style.left=speed+"px";
},60);
}
funny();
}
</script>
</head>
<body>
<divid="div2">
<divid="div1">
<ulid="ul1">
<li><imgsrc="../../images/choose.png">
</li>
<li><imgsrc="../../images/deck.png">
</li>
<li><imgsrc="../../images/el.png">
</li>
<li><imgsrc="../../images/list.png">
</li>
</ul>
</div>
</div>
</body>
</html>
⑼ javascript麻烦帮我看下 哪里错了我想做一个简单的图片轮换效果!
试试这个图片轮换效果
功能比你的强大很多
有12345数字一起切换
鼠标点一下数字会变换到另一张图片,不点就会自动换
里面有教程和源码
⑽ JS图片轮播的原理。。。
<script type="text/javascript">
var t = n = 0, count;
$(document).ready(function(){
count=$("#ban_list a").length;//获取图片数目
$("#ban_list a:not(:first-child)").hide();//除第一张图片都隐藏
$("#ban_info").html($("#ban_list a:first-child").find("img").attr('alt'));//这个是把alt里的内容作为标题
$("#ban_info").click(function(){window.open($("#ban_list a:first-child").attr('href'), "_blank")});//给标题绑定点击事件,添加链接
$("#ban li").click(function() { //按钮点击事件
var i = $(this).text() - 1;//获取Li元素内的值,即1,2,3,4
n = i;
if (i >= count) return;
$("#ban_info").html($("#ban_list a").eq(i).find("img").attr('alt'));//重新获取标题
$("#ban_info").unbind().click(function(){window.open($("#ban_list a").eq(i).attr('href'), "_blank")})//重新绑定标题点击事件
$("#ban_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);//渐进渐出效果
document.getElementById("ban").style.background="";
$(this).toggleClass("on");//切换按钮样式
$(this).siblings().removeAttr("class");
});
t = setInterval("showAuto()", 4000);
$("#ban").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
})//鼠标指上停止轮播
function showAuto()//实现轮播的函数
{
n = n >=(count - 1) ? 0 : ++n;
$("#ban li").eq(n).trigger('click');
}
</script>
<div id="ban">
<div id="ban_bg"></div>
<div id="ban_info"></div>
<ul>
<li class="on">1</li>
<li>2</li>
<li>3</li>
</ul>
<div id="ban_list">
<a href="/Item/Show.asp?m=1&d=3824" target="_blank"><img src="/UploadFiles/2012-08/admin/2012081511562273110.jpg" alt="" width="414" height="286" /></a>
</div>