我想做一个淡出的新闻行情。代码似乎没问题,但它不起作用。现在我已经将样式和脚本放在 html.erb 中(它是一个 ruby on rails 部分)
<ol>
<li class="divider">Company Pulse</li>
</ol>
<ol id="scrollable" style="height:90px; overflow:hidden;">
<% @tweets.each do |tweet| %>
<li>
<%= link_to "
<div id=\"twitter_presence\" style=\"vertical-align: middle;\">
<img src=\"#{tweet.user.profile_image_url}\" style=\"vertical-align:middle;\"/>
<span style=\"vertical-align: middle;\">#{tweet.user.name}</span>
</div>
<span id=\"twitter_text\">
<h3 style=\"text-align: center\">\" #{tweet.text} \"</h3>
<h3 style=\"text-align:right\">#{tweet.created_at}</h3>
</span>
".html_safe, 'employees/twitter' %>
</li>
<% end %>
</ol>
<script type="text/javascript">
var aniSpd01 = 1000;
var fadeSpd01 = 1000;
$(function()
{
var startIndex = 0;
var endIndex = $('#scrollable li').length;
$('#scrollable li:first').fadeIn(fadeSpd01);
window.setInterval(function()
{
$('#scrollable li:eq(' + startIndex + ')').delay(fadeSpd01).fadeOut(fadeSpd01);
startIndex++;
$('#scrollable li:eq(' + startIndex + ')').fadeIn(fadeSpd01);
if (endIndex == startIndex) startIndex = 0;
}, aniSpd01);
});
</script>
可能出了什么问题以及如何解决?