今天来分享一下鼠标点击按钮,图片进行切换+图片自动切换+点击左右按钮图片进行切换的三种效果的组合代码。
最后的效果如下:
Html代码部分:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>图片轮播效果制作_赵一鸣随笔博客</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <script type="text/javascript" src="/UploadFiles/2021-04-02/jquery.js">Css代码部分:
*{margin:0px;padding:0px} li{list-style:none} a{text-decoration:none} img{border:0px} .banner{width:350px;height:495px;margin:100px auto;position:relative;overflow:hidden} .banner .pic{width:9999px;height:495px} .banner .pic li{width:350px;height:495px;float:left} .banner .anniu{width:100px;height:16px;position:absolute;left:165px;top:470px} .banner .anniu li{width:16px;height:16px;background:white;float:left;margin:2px;display:inline; cursor:pointer;border-radius:100%} .banner .anniu li.on{background:red} .banner .lr{width:350px;height:50px;position:absolute;top:250px;display:none} .banner .lr a{color:white} .banner .lr .pre{width:20px;height:50px;float:left;background:none repeat scroll 0px 0px rgba(1, 0, 0, 0.6);text-align:center;line-height:50px;cursor:pointer} .banner .lr .next{width:20px;height:50px;float:right;background:none repeat scroll 0px 0px rgba(1, 0, 0, 0.6);text-align:center;line-height:50px;cursor:pointer}Javascript代码部分:
$(function(){ //鼠标滑过banner,左右按钮进行显示和隐藏 $(".banner").hover(function(){ $(".lr").show(); },function(){ $(".lr").hide(); }); //点击下面的小按钮,图片进行左右切换效果 $(".anniu li").click(function(){ $(this).addClass("on").siblings().removeClass("on"); var num=$(this).index(); $(".pic").animate({marginLeft:-350*num},"slow"); }); //图片自动轮播效果 var a=0; var automatic=setInterval(function(){ a++; a=a%5; $(".pic").animate({marginLeft:-350*a},"slow"); $(".anniu li").eq(a).addClass("on").siblings().removeClass("on"); },6000); //点击左右按钮,图片进行切换效果 $(".pre").click(function(){ a--; a=(a+5)%5; $(".pic").animate({marginLeft:-350*a},"slow"); $(".anniu li").eq(a).addClass("on").siblings().removeClass("on"); }); $(".next").click(function(){ a++; a=a%5; $(".pic").animate({marginLeft:-350*a},"slow"); $(".anniu li").eq(a).addClass("on").siblings().removeClass("on"); }); });
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“js鼠标点击按钮切换图片-图片自动切换-点击左右按钮切换特效代码”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
20240727
20240727
- 丁当《日与夜,跟自己说晚安》[320K/MP3][98.51MB]
- 何炅.2005-漫游【中唱】【WAV+CUE】
- 何嘉莉.1998-MYDREAMS(EP)【飞图】【WAV+CUE】
- 群星.2019-天坑鷹猎电视剧原声带(EP)【智慧大狗】【FLAC分轨】
- 【雨果唱片】《春江花月夜》2020【WAV+CUE】
- 【正原唱片】女子十二乐坊《发烧国乐精粹-十二乐坊》WAV+CUE
- [黄翠珊]SusanWong-TheBestofSusanWong[WAV+CUE]
- 杜德伟.1995-BEST.LOVE(英)【滚石】【WAV+CUE】
- 杜德伟.1996-BEST.LOVE.2(英)【滚石】【WAV+CUE】
- 陈柏宇.2008-Change【SONY】【FLAC分轨】
- 丁当《日与夜,跟自己说晚安》[FLAC/分轨][285.42MB]
- 早安《Bubble Vision》[320KMP3][36.83MB]
- 叶振棠《叶振棠歌曲合集》[合集][MP3][145.9MB]
- [黄翠珊]SusanWong-ClosetoMe[SACD]dsf
- 中唱唱片群星《好歌珍藏-民歌精粹》2CD[WAV.]