侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

图片轮播图_点击左右按钮切换_轮播自由控制效果jq实现

前端  /  管理员 发布于 5年前   561
        <style type="text/css">
         .img-scroll { position:relative; margin:20px auto; width:100%;}
         .img-scroll .prev,.img-scroll .next { position:absolute;top: 200px;color: #999;font-size: 60px;}
         .img-scroll .prev { left:0;cursor:pointer;}
         .img-scroll .next { right:0;cursor:pointer;}
         .img-list { position:relative; width:320px;height: 635px; margin-left:75px; overflow:hidden}
         .img-list ul { width:100%;}
         .img-list li { float:left; display:inline; width:100%;height:100%; margin-right:10px; background-color:#BDBDDF; text-align:center;}
        </style>
        <div class="img-scroll">
            <span class="prev"><</span>
            <span class="next">></span>
            <div class="img-list">
                <ul>
                    <li><img style="width:100%;" src="images/005-1.png"></li>
                    <li><img style="width:100%;" src="images/005-2.png"></li>
                    <li><img style="width:100%;" src="images/005-3.png"></li>
                    <li><img style="width:100%;" src="images/005-4.png"></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>

效果图就不贴了 需要的自己试试 改改就能用


  • 上一条:
    点击两张图切换效果简单jq实现
    下一条:
    原生JS实现Ajax通过GET方式与PHP进行交互操作示例
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • jq中实现图片压缩、base64转成file后上传至服务器示例(0个评论)
    • 在JavaScript中实现批量下载OSS中的文件代码示例(0个评论)
    • 如何优雅处理async await错误推荐:await-to-js库(0个评论)
    • lodash工具库(0个评论)
    • nginx + vue配置实现同域名下不同路径访问不同项目(0个评论)
    • 近期文章
    • Laravel 10.13版本发布(0个评论)
    • 在github创建task的同时创建分支流程步骤(0个评论)
    • 在go语言中以邮件标题中获取SPF和DMARC,来判断是否为垃圾邮件之垃圾邮件过滤器功能实现(0个评论)
    • 在go语言中使用attr字段标签提取XML属性数据示例(0个评论)
    • 在laravel中介绍一个生成假数据的PHP库:FakerPHP(0个评论)
    • 在laravel框架中对环境配置文件的加载过程步骤浅析(0个评论)
    • Laravel 10.12版本发布(0个评论)
    • 在go语言中如何记录每个HTTP请求到你的Web服务器、日志记录器?(0个评论)
    • 在Go语言中如何查找一个IP地址的网络地址?(0个评论)
    • ELK + Filebeat 搭建日志系统流程步骤(0个评论)
    • 近期评论
    • 博主 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..
    • xiaoB 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..
    • BUG4 在

      你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..
    • 博主 在

      go语言+beego框架中获取get,post请求的所有参数中评论 @ t1  直接在router.go文件中配就ok..
    • Jade 在

      如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
    • 2016-11
    • 2017-06
    • 2017-07
    • 2017-08
    • 2017-09
    • 2017-10
    • 2017-11
    • 2018-03
    • 2018-04
    • 2018-05
    • 2018-06
    • 2018-09
    • 2018-11
    • 2018-12
    • 2019-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2022-08
    • 2022-09
    • 2022-10
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-04
    • 2023-05
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客