用 JS 点击左右按钮 使图片切换 - 最精简版-ljx2380000-ChinaUnix博客
body
{
font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif;
font-size: 10.5pt;
line-height: 1.5;
}
html, body
{
}
h1 {
font-size:1.5em;
font-weight:bold;
}
h2 {
font-size:1.4em;
font-weight:bold;
}
h3 {
font-size:1.3em;
font-weight:bold;
}
h4 {
font-size:1.2em;
font-weight:bold;
}
h5 {
font-size:1.1em;
font-weight:bold;
}
h6 {
font-size:1.0em;
font-weight:bold;
}
img {
border:0;
max-width: 100%;
}
blockquote {
margin-top:0px;
margin-bottom:0px;
}
table {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
td {
border-collapse:collapse;
border:1px solid #bbbbbb;
}
用 JS 点击左右按钮 使图片切换 - 最精简版-ljx2380000-ChinaUnix博客
代码部分:
点击(此处)折叠或打开
- <!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" />
- <title>实用的图片切换</title>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script>
- <!--<script type="text/javascript" src="jquery_change.js"></script>-->
- <style type="text/css">
- body,ul,li { padding:0; margin:0}
- ul,li { list-style:none}
- .img-scroll { position:relative; margin:20px auto; width:440px;}
- .img-scroll .prev,.img-scroll .next { position:absolute; display:block; width:50px; height:100px; background-color:#000;
- top:0; color:#FFF; text-align:center; line-height:100px}
- .img-scroll .prev { left:0;cursor:pointer;}
- .img-scroll .next { right:0;cursor:pointer;}
- .img-list { position:relative; width:320px; height:100px; margin-left:60px; overflow:hidden}
- .img-list ul { width:9999px;}
- .img-list li { float:left; display:inline; width:100px; margin-right:10px; height:100px; background-color:#BDBDDF; text-align:center; line-height:100px;}
- </style>
- </head>
- <body>
- <div class="img-scroll">
- <span class="prev">prev</span>
- <span class="next">next</span>
- <div class="img-list">
- <ul>
- <li><img style="width:100px;height:100px;" src="./img/cat.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/katong.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/meinv.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/mm.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/慢慢.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/美食杰-糖糖.jpg"></li>
- <li><img style="width:100px;height:100px;" src="./img/未命名44.jpg"></li>
- </ul>
- </div>
- </div>
- <script type="text/javascript">
- function DY_scroll(wraper,prev,next,img,speed,or)
- {
- var wraper = $(wraper);
- var prev = $(prev);
- var next = $(next);
- var img = $(img).find('ul');
- var w = img.find('li').outerWidth(true);
- var s = speed;
- next.click(function()
- {
- img.animate({'margin-left':-w},function()
- {
- img.find('li').eq(0).appendTo(img);
- img.css({'margin-left':0});
- });
- });
- prev.click(function()
- {
- img.find('li:last').prependTo(img);
- img.css({'margin-left':-w});
- img.animate({'margin-left':0});
- });
- if (or == true)
- {
- ad = setInterval(function() { next.click();},s*1000);
- wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next.click();},s*1000);});
- }
- }
- DY_scroll('.img-scroll','.prev','.next','.img-list',3,false);// true为自动播放,不加此参数或false就默认不自动
- </script>
- </body>
- </html>
用 JS 点击左右按钮 使图片切换 - 最精简版-ljx2380000-ChinaUnix博客的更多相关文章
- PHP——0128练习相关2——js点击button按钮跳转到另一个新页面
js点击button按钮跳转到另一个新页面 投稿:whsnow 字体:[增加 减小] 类型:转载 时间:2014-10-10我要评论 点击按钮怎么跳转到另外一个页面呢?点击图片要跳转到新的页面时,怎么 ...
- jquery带按钮的图片切换效果
<!doctype html> <html> <head> <meta charset="gb2312"> <title> ...
- 用html5(requestFullscreen) js实现点击一个按钮使浏览器全屏效果
项目中需要将后台浏览器的窗口全屏,也就是我们点击一个按钮要实现按F11全屏的效果. 在HTML5中,W3C制定了关于全屏的API,就可以实现全屏幕的效果,也可以让页面中的图片,视频等全屏目前只有goo ...
- JS 点击复制按钮 将文字复制到手机剪贴板
我们在制作移动端网页的时候,经常会遇到这样一个问题,如何点击一个"复制"按钮,把一串文字复制到手机剪贴板,如上图所示. 看了网上的一些方法后,感觉那些方法都太复杂,有点要用插件,有 ...
- js实现点击上下按钮,图片向上向下循环滚动切换
//popup.js //jquery.1.4.2-min.js (function(p,j){function u(){if(!c.isReady){try{v.documentElement.do ...
- js点击button按钮跳转到页面代码
点击按钮怎么跳转到另外一个页面呢?我们在网站制作中可能是需要的,因为有时我们需要做这样的效果,尤其是将按钮做成一个图片,而点击图片要跳转到新的页面时,怎么做到呢? 这样的效果可以:onclick=&q ...
- js点击button按钮跳转到另一个新页面
点击按钮怎么跳转到另外一个页面呢?我们在网站制作中可能是需要的,因为有时我们需要做这样的效果,尤其是将按钮做成一个图片,而点击图片要跳转到新的页面时,怎么做到呢? 这样的效果可以:onclick=&q ...
- 【基础篇】点击Button按钮更换图片
我们在开发的过程中,往往为了美化界面的需要,会修改按钮的默认外观,而因为Android中的按钮有三种状态—默认,被点击,被选中.所以,如果要改变按钮的外观,需要对这三种情况都做出修改,也许在以往,我们 ...
- js点击重置按钮重置表单
<html><head><script type="text/javascript">function formReset(){document ...
随机推荐
- wl18xx编译的时候出现WARNING: "simple_open" WARNING: "wl12xx_get_platform_data"
................................................................................................... ...
- Greedy Change
Greedy Change time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- php fsockopen
1.PHP fsockopen函数说明: Open Internet or Unix domain socket connection(打开套接字链接) Initiates a socket conn ...
- sql 指定范围 获取随机数
DECLARE @nMinimumCount INT= 1DECLARE @nMaximumCount INT= 100SELECT abs(CHECKSUM(NEWID()))%(@nMaximum ...
- C语言开发工具
1.编写程序的工具: indent命令将自动调整C代码的缩进风格,个人比较喜欢indent -kr 2.编译C语言程序: 1.gcc编译器: gcc是一个ANSI C兼容编译器,C++编译器也可以编译 ...
- 学习笔记——适配器模式Adapter
适配器模式适用于将不一致的接口转换为一致的接口. 比如,去香港玩儿,带上了自己的笔记本电脑,结果晚上插电时就抓瞎了,电源插孔与插座不一致.WTF…… 插座是酒店装好的,不可能拆了换一个,电源是自己的, ...
- JNDI深入浅出
1.什么是JNDI JNDI(The Java Naming and Directory Interface,Java命名和目录接口)是一组在Java应用中访问命名和目录服务的API.命名服务将名称和 ...
- 转:loadrunner ---循环输出关联数组
web_reg_save_param,将Ord参数值设定为ALL,则关联函数将自动把符合条件的关联值保存到参数数组里.在本例中,假设关联值返回三条记录,则LR分别将值保存到sor_1,sor_2,so ...
- HDU 1043 八数码(八境界)
看了这篇博客的讲解,挺不错的.http://www.cnblogs.com/goodness/archive/2010/05/04/1727141.html 判断无解的情况(写完七种境界才发现有直接判 ...
- PAT (Advanced Level) 1095. Cars on Campus (30)
模拟题.仔细一些即可. #include<cstdio> #include<cstring> #include<cmath> #include<algorit ...