阅读模式:

Jquery栏目无缝滚动效果

查看:4500  回复:0  类型:  来源:php自学网  标签 jquery

Jquery栏目无缝滚动效果,支持从左往右或从右往左无缝滚动。

代码示例:

<!DOCTYPE html>
<html lang="ZH-CN">
<head>
    <meta charset="utf-8"/>
    <title>Jquery无缝滚动效果</title>
    <script src="http://libs.baidu.com/jquery/1.8.3/jquery.min.js"></script>
    <style type="text/css">
        .container { width:1133px; height:auto; position:relative;  margin:0 auto;}
        .new { height:445px; background:#f4f4f4; }
        .new .new_tit { font-size:18px; text-align:left; color:#332d2a; padding-top:55px; padding-bottom:10px;}
        .new .new_tit a:hover { color:#e71d4d;}
        .new .nw { width:100%; position: absolute;left:0; top:90px; z-index:1; height:345px; overflow:hidden;}
        .new .nw .allnew { width:2000px; height:294px; padding-top:5px; overflow:hidden; }
        .new .nw .nl  { float:left; margin-right:33px; -webkit-transform: translate(0,0);transform: translate(0,0);-webkit-transition: all ease-out 0.6s 0s;transition: all ease-out 0.6s 0s;}
        .new .nw .nl:hover { -webkit-transform: translate(0,-5px); transform: translate(0,-5px); }
        .new .nw .nl a { width:355px; height:305px;  }
        .new .nw .nl a .img { display: block; width:356px; height:234px;border:1px solid red; background:green;}
        .new .nw .nl a h1 { font-size:14px; font-weight:400; color:#1f1f1f; padding-top:20px; padding-bottom:4px;}
        .new .nw .nl a h2 { color:rgba(120,120,120,0.6); font-size:12px;}
        .new .n_left { display:block; position:absolute;left:-40px; top:220px; z-index:10; cursor:pointer;width:20px;height:20px;border:1px solid red;}
        .new .n_right { display:block; position:absolute;right:-36px; top:220px; z-index:10; cursor:pointer;width:20px;height:20px;border:1px solid red;}
    </style>
</head>

<body>


<div class="new">
    <div class="container">
        <p class="new_tit"><a href="javascript:;">Jquery栏目无缝滚动效果</a></p>
        <div class="n_left">左</div>
        <div class="nw">
            <div class="allnew">
                <div class="nl">
                    <a href="javascript:;">
                        <div class="img"></div>
                        <h1>标题一</h1>
                    </a>
                </div>
                <div class="nl">
                    <a href="javascript:;">
                        <div class="img"></div>
                        <h1>标题二</h1>
                    </a>
                </div>
                <div class="nl">
                    <a href="javascript:;">
                        <div class="img"></div>
                        <h1>标题三</h1>

                    </a>
                </div>
                <div class="nl">
                    <a href="javascript:;">
                        <div class="img"></div>
                        <h1>标题四</h1>

                    </a>
                </div>
                <div class="nl">
                    <a href="javascript:;">
                        <div class="img"></div>
                        <h1>标题五</h1>
                    </a>
                </div>
            </div>
        </div>
        <div class="n_right">右</div>
    </div>
</div>

<script>
    $('.n_left').click(function(){
        $('.allnew').animate({'marginLeft':'360px'},200,function(){
            $('.allnew').prepend($('.allnew .nl').last());
            $('.allnew').css('margin-left','0px');
        });
    });
    $('.n_right').click(function(){
        $('.allnew').animate({'marginLeft':'-360px'},200,function(){
            $('.allnew .nl').eq(0).appendTo(".allnew");
            $('.allnew').css('margin-left','0px');
        });
    });
</script>
</body>
</html>

在线预览效果:Jquery栏目无缝滚动效果


分享到:
0 0

*有问题之处烦请在评论中指出非常感谢!
不是我想要的内容,继续搜索:

扫描二维码手机查看

发布评论:


登录:
  表情:
评论话题
推荐阅读:
mysql共享锁和排他锁详解   阅读:8622centos 7.2 添加php7 的 php-fpm 开机启动   阅读:26915crontab+shell脚本实现定时备份mysql数据库   阅读:8764javascript获取两个日期间的所有日期   阅读:7908linux top命令详解   阅读:10899mysql中文分词全文搜索索引讯搜的安装   阅读:8206简单的DOS攻击之死亡之ping详解   阅读:70840php显示刚刚、几分钟前、几小时前、几天前的函数   阅读:9894php删除一个文件夹内的所有文件夹和文件   阅读:5905面试都会问你为什么你从上一家公司离职的真实意思   阅读:12644封装php redis缓存操作类   阅读:10514给网站添加一键新浪微博登录的功能   阅读:7442centos 7 安装 nginx-1.11.10   阅读:9638php打印九九加法表   阅读:12619php打印九九乘法表   阅读:12862linux php7安装yaf扩展   阅读:9824Nginx 配置文件详解   阅读:6121给网站添加一键qq登录的功能   阅读:8691企业让你去面试,可能不是真的招人   阅读:6859移动端自适应rem原理   阅读:10694给php7安装redis扩展库   阅读:9486mysql数据一键导出到csv文件   阅读:6812centos7.3安装mongodb3.6   阅读:8841php打印九九乘法表   阅读:12862移动端自适应rem原理   阅读:10694web性能测试工具ab的测试方法   阅读:5552用php从1加到100的值   阅读:10189html5 离线缓存的使用   阅读:5124人性漫画:打工与创业的残酷区别   阅读:5892centos 7 安装 mysql-5.7   阅读:8972纯干货,程序员面试的超实用技巧   阅读:5146php打印三角形   阅读:12996PHP 鸟哥:我也曾经是“不适合”编程的人   阅读:16535centos 7 安装 redis 3.2.9   阅读:7677php连接redis   阅读:6590centos 7 修改系统屏幕分辨率   阅读:50282人性漫画:打工与创业的残酷区别   阅读:5892centos7开启交换内存   阅读:12578mysql共享锁和排他锁详解   阅读:8622shell脚本统计当前服务器并发连接数   阅读:8965Nginx 配置文件详解   阅读:6121比phpexcel还要简单的excel CSV 一键导入数据到数据库   阅读:6199centos 7 忘记root密码   阅读:5907centos7开启交换内存   阅读:12578javascript对cookie操作详细代码函数   阅读:6206javascript点击复制内容   阅读:8239Mysql在大型网站的应用架构演变   阅读:5496用php从1乘到100的值   阅读:7345企业让你去面试,可能不是真的招人   阅读:6859shell脚本破解十位数内的所有纯数字rar加密压缩包脚本   阅读:10398