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>