web实现左右切换功能
来源:互联网 发布:尼尔森数据网 编辑:程序博客网 时间:2024/06/05 08:33
<!DOCTYPE html><html><head><meta charset="utf-8" /><title></title><script type="text/javascript" src="js/jquery-1.12.0.min.js"></script><style type="text/css">div,ul,li{margin: 0px;padding: 0px;}.box{border: 5px solid orange;overflow: hidden;width: 500px;height: 400px;display: inline-block;background: green;position: relative;}.box-ul-li1{float: left;background: orangered;}.box-ul-li2{float: left;background: orange;}.box-ul-li3{float: left;background: green;}.box-ul-li1,.box-ul-li2,.box-ul-li3{width: 500px;height: 400px;position: relative;}.box-ul{position: absolute;width: 99999px;height: 400px;list-style: none;background: red;}.button-box{top: 50%;position: relative;width: 500px;height: 45px;z-index: 1;}.left-button{color: white;left: 0px;position: absolute;font-size: 26px;border-style: none;width: 50px;height: 45px;background: rgba(0,0,0,0.4);}.right-button{color: white;position: absolute;right: 0px;font-size: 26px;border-style: none;width: 50px;height: 45px;background: rgba(0,0,0,0.4);}.box-ul-img{width: 500px;height: 400px;}</style><script type="text/javascript">$(document).ready(function(){var value = 0;$(".box").mouseover(function(){$(".button-box").css("visibility","visible");});$(".box").mouseout(function(){$(".button-box").css("visibility","hidden");});//左边的按钮,把ul元素往右边移$(".left-button").click(function(){if(value >= -500){value-=500;$(".box-ul").animate({left:value},500);}});//右边的按钮,把ul元素往左边移$(".right-button").click(function(){if(value <= -500){value+=500;$(".box-ul").animate({left:value},500);}});});</script></head><body style="text-align: center;"><div class="box"><ul class="box-ul"><li class="box-ul-li1"><img class="box-ul-img" src="img/a.jpg"/></li><li class="box-ul-li2"><img class="box-ul-img" src="img/b.jpg"/></li><li class="box-ul-li3"><img class="box-ul-img" src="img/c.jpg"/></li></ul><div class="button-box"><button class="left-button"><</button><button class="right-button">></button></div></div></body></html>
效果图如下:
0 0
- web实现左右切换功能
- 图片左右循环切换功能的实现
- 多图片左右切换功能前端实现
- unity-使用NGUI 两个Button实现左右切换功能
- 实现左右屏切换
- ViewPager实现左右切换
- CSDN-实现左右标签切换
- 实现左右滑动切换Activity
- Android实现页面左右切换
- ViewDragHelper实现卡片左右切换
- js实现左右切换页面
- 使用Fragment实现底部菜单栏功能,并实现左右滑动切换
- ViewPager取消左右滑动切换功能
- ViewPager取消左右滑动切换功能
- ViewPager撤消左右滑动切换功能
- ViewPager禁止左右滑动切换功能
- TabLayout+ViewPager撤消左右滑动切换功能
- ViewPager撤消左右滑动切换功能
- 如何拖动DOM元素
- Android读取SD卡文件并显示到textview中
- http协议状态码总结
- 不让safari浏览器下载的Excel文件添加.exe后缀
- Wireshark抓包工具使用教程以及常用抓包规则
- web实现左右切换功能
- 获取手机IP
- python 的logging模块
- jquery在当前页面打印页面div内容实例
- Android 开源框架Glide应用(一)
- 最近研究RabbitMQ的一些心得
- python 打包
- 有return的情况下try catch finally的执行顺序(最有说服力的总结)
- ajax实时更新数据