html中内容:
<div class="time" >
<span class="t">交易时段(北京时间):</span><div class="c">
<ul id="scrollCtpTime">
<#list 0..(timesList?size - 1) as i>
<li>
<#if timesList.get(i).timeType==0>早盘:
<#elseif timesList.get(i).timeType==1>午盘:
<#elseif timesList.get(i).timeType==2>夜盘:
</#if>
${timesList.get(i).startTime!}-${timesList.get(i).endTime!}
<#if timesList.get(i).stopTime?exists && timesList.get(i).stopTime?length gt 0>,${timesList.get(i).stopTime}系统自动平仓
</#if>
</li>
</#list>
</ul>
</div>
</div>
js中内容:
<!--交易时段滚动 -->
<script>
var scroll;
function scrollCtp(){
scroll = null;
if ($('#scrollCtpTime').children('li').length >= 2) {
$('#scrollCtpTime').animate({
marginTop : '-24px'
}, 1500, function() {
if (scroll == null) {
$('#scrollCtpTime').children('li:first').appendTo($('#scrollCtpTime'));
$('#scrollCtpTime').css('marginTop', '0px');
scroll = setTimeout("scrollCtp()",1000);
}
});
}
}
$('#scrollCtpTime').parent().hover(function() {
if (scroll != null) {
clearTimeout(scroll);
scroll = null;
}
}, function() {
if (scroll == null) {
scroll = setTimeout("scrollCtp()", 1000);
}
});
scroll = setTimeout("scrollCtp()", 1000);
</script>