文字图片自动向上滚动

js:

setTimeout(scrollToTop, 1000);
            //var no = 0;
            function scrollToTop() {                
                var scrollElement = $(".txtScroll-top .bd ul");
                scrollElement.each(function (index, domEle) {
                    var scrollTotalHeight = $(domEle).height();
                    $(domEle).height(scrollTotalHeight); $(domEle).css('position', 'relative');
                    var scrollHeight = $(domEle).children().eq(0).height();
                    if ($(domEle).position().top <= -scrollTotalHeight) {
                        $(domEle).css('top', 0);
                        no = 0;
                    }
                    $(domEle).animate({ 'top': $(domEle).position().top -= scrollHeight }, "slow");
                })               
                setTimeout(scrollToTop, 800);
            }

html:

<div class="txtScroll-top">
                <i data-bind="click: $parent.openlist.bind($data, name)">
                    <img data-bind="attr: { src: image }" src="/report/images/nm.png"><!-- ko text:name-->有色金属<!-- /ko --></i>
                <div class="bd">
                    <div style="overflow: hidden; position: relative; height: 60px">
                        <ul class="infoList" style="height: 150px; position: relative; top: -30px;">
                            <!-- ko foreach:reports-->
                            <li><a data-bind="attr: { href: '/report/' + ReportID + '.html' }, text: Title" href="/report/237971.html">2022-2023中国铜市场年度报告</a></li>
                            
                            <li><a data-bind="attr: { href: '/report/' + ReportID + '.html' }, text: Title" href="/report/237943.html">2022-2023中国铅市场年度报告</a></li>
                            
                            <li><a data-bind="attr: { href: '/report/' + ReportID + '.html' }, text: Title" href="/report/237779.html">2022-2023中国锌市场年度报告</a></li>
                            
                            <li><a data-bind="attr: { href: '/report/' + ReportID + '.html' }, text: Title" href="/report/237764.html">2022-2023中国铝市场年度报告</a></li>
                            
                            <li><a data-bind="attr: { href: '/report/' + ReportID + '.html' }, text: Title" href="/report/237711.html">2022-2023中国镍及不锈钢市场年度报告</a></li>
                            <!-- /ko -->
                        </ul>
                    </div>
                </div>
                <a class="more" data-bind="click: $parent.openlist.bind($data, name)">更多</a>
            </div>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值