在公司学习前端之jq和js的列表数大于5的列表滚动

        .keshi{
            height: 164px;
            overflow-y: hidden;
        }
        .keshi .gund {
            animation: move 150s linear;
            animation-iteration-count: infinite;
        }

<div class="list_container">

            <div class="tit_big"><b>退租企业名单</b></div>
            <div style="height: 45px ;width: 100%">
            </div>
            <div id="IA6" class="tab_li" >
                <div class="tit_IA"><div >企业名称</div><div class="tit_IA1">退租时间</div></div>
                <div class="keshi2">  <div class="gund2"> <div class="list_IA" ng-repeat="(x, y) in tzlist"> <div >{{y.Name}}</div><div >{{y.value}}</div></div></div></div>
            </div>
        </div>
    var app_list = angular.module("index_IA", []);
    app_list.controller("index_IA_list", function($scope) {

        ajaxCommonFunction2("zhaoShangService","getRentOutCompany","", function (str){
            $scope.tzlist = str;
            $scope.$apply();
            setTimeout(function () {
            var $container = document.querySelector('.gund');
            var $conHeight = $container.scrollHeight-164;
            // var $bodyHeight = $container.offsetHeight;
            // var diff = Math.floor($conHeight - $bodyHeight);
            // var $childs = $container.children;
            // console.log($conHeight,$bodyHeight,diff)
            if ($scope.dqlist.length>5){
                var style = document.createElement('style');
                style.type = 'text/css';
                try {
                    style.appendChild(document.createTextNode('@keyframes move{ from { transform: translateY(0); } to { transform: translateY(-'+ $conHeight +'px); } }'))
                } catch (error) {
                    style.styleSheet.cssText = '@keyframes move{ from { transform: translateY(0); } to { transform: translateY(-' + $conHeight + 'px); } }';
                }
                $container.class="gundmove";
                var head = document.querySelector("head");
                head.appendChild(style);}
        },2000);
        });

做个笔记,大哥的代码还是有点东西的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值