javascript - 帮忙看下为什么左右点击按钮的that.Ul.style.left值怎么写才能移动
高洛峰
高洛峰 2017-04-11 10:31:09
[JavaScript讨论组]

这里的that.Ul.style.left值 怎么写才能保存住上次的值

// css 部分

   *{
        margin: 0;
        padding: 0;
    }
    .scroll{
        overflow: hidden;
        clear: both;
        width: 1200px;
        margin: 0 auto;
        position: relative;
    }
    .scroll li{
        width: 280px;
        float: left;
        list-style: none;
    }
    .scroll .pre{
        width:30px;
        height: 240px;
        line-height: 240px;
        background: #ccc;
        float: left;
        text-align: center;
        font-size: 18px;
        font-weight: bold;
        margin-right: 10px;
        position: absolute;

    }
    .scroll .next{
        right: 0;
    }
    .scroll .pre a{
        display: block;
        text-decoration: none;
    }

    .scroll ul{
        width: 1000000px;
        overflow: hidden;
        float: left;
        left: 0;
        position: absolute;
        transition: all 0.5s ease 0s;
    }

    .scroll .active,.scroll .pre a:hover{
        background: #05c0e2;
        color:#fff;
    }
    .last{
        background: #ccc;
    }
    #jsulbox{
        width:1100px;
        overflow: hidden;
        height: 240px;
        left:40px;
        overflow: hidden;
        position: relative;
        float: left;
    }
    .prenext{
        width: 100%;
    }

//HTML 部分

<

>

// javascript 部分

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

全部回复(1)
高洛峰

用计算后的样式。
还有你js最后的括号位置写反了。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号