欢迎来到php自学网~
阅读模式:

Jquery栏目无缝滚动效果

查看:2009  回复: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

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

扫描二维码手机查看

发布评论:


登录:
  表情:
评论话题
推荐阅读:
php删除一个文件夹内的所有文件夹和文件   阅读:1554霍金24岁博士毕业论文在线预览   阅读:1189linux命令中执行php脚本   阅读:1381企业让你去面试,可能不是真的招人   阅读:1418centos 7 修改系统屏幕分辨率   阅读:13531linux教程,鸟哥私房菜(pdf全集)   阅读:1475php冒泡排序法   阅读:1146linux top命令详解   阅读:1304栈和堆的区别   阅读:1224mysql数据一键导出到csv文件   阅读:1517php 读取和设置redis的键值   阅读:2447mysql5.7开启sql日志的配置   阅读:1634php打印九九乘法表   阅读:1649小米手机端商城rem适配原理   阅读:2632解决 nginx 413 request entity too large   阅读:1197一步步带你,如何网站架构   阅读:1221mysql数据库性能的基本优化   阅读:1615linux php7安装yaf扩展   阅读:1139centos 7 安装 mysql-5.7   阅读:1798最简单的Banner轮播淡入淡出效果代码及实现思路(附带源码)   阅读:5489centos 7 添加 redis 3.2.9 开机启动脚本   阅读:2805php 获取当前前后年、月、星期、日、时分秒的时间   阅读:1736nginx编译安装后对nginx进行平滑升级   阅读:88php显示刚刚、几分钟前、几小时前、几天前的函数   阅读:1764php生成二维码   阅读:1655nginx编译安装后对nginx进行平滑升级   阅读:88php生成二维码   阅读:1655phpexcel 超简单从excel表格一键导入数据到数据库教程   阅读:4631把php session 会话保存到redis   阅读:1994人性漫画:打工与创业的残酷区别   阅读:1214linux教程,鸟哥私房菜(pdf全集)   阅读:1475什么是天使轮?什么是A轮融资?B轮融资?   阅读:947mysql共享锁和排他锁详解   阅读:1632用php从1乘到100的值   阅读:1757最简单的Banner轮播左右切换效果代码及实现思路(附带源码)   阅读:11137php删除一个文件夹内的所有文件夹和文件   阅读:1554Nginx 配置文件详解   阅读:1397解决 nginx 413 request entity too large   阅读:1197shell脚本破解十位数内的所有纯数字rar加密压缩包脚本   阅读:1545纯干货,程序员面试的超实用技巧   阅读:1118centos 7 安装 samba 服务   阅读:1453php删除一个文件夹内的所有文件夹和文件   阅读:1554面试的时候和你谈理想,是理想or入坑?   阅读:1272mysql数据一键导出到csv文件   阅读:1517centos 7 安装 mysql-5.7   阅读:1798mysql5.7开启sql日志的配置   阅读:1634nginx编译安装后对nginx进行平滑升级   阅读:88php设置cookie为HttpOnly防止XSS攻击   阅读:2061centos 7 安装 php-7.1.3   阅读:7273nginx编译安装后对nginx进行平滑升级   阅读:88