javascript垂直新闻自动收报机不起作用

时间:2014-03-18 06:05:35

标签: javascript jquery html css news-ticker

我有一个像这样的HTML代码段:

<div>
<div>&nbsp;</div>
<div class="news">
<ul id="listticker">
 <li><b>"Lorem Ipsum is a dummy text used by designers from all over the world. While writing Lorem ipsum you dont need worry grammar about and splleing mistkae. You get complete freedome of writing anything you want. I love Lorem Ipsum so much. .</li>
 <li><b>"Lorem Ipsum is a dummy text used by designers from all over the world. While writing Lorem ipsum you dont need worry grammar about and splleing mistkae. You get complete freedome of writing anything you want. I love Lorem Ipsum so much. </li>
 <li><b>"Lorem Ipsum is a dummy text used by designers from all over the world. While writing Lorem ipsum you dont need worry grammar about and splleing mistkae. You get complete freedome of writing anything you want. I love Lorem Ipsum so much. . </li>
</ul>
</div>
</div>

我在这里调用了像这样的news_ticker脚本

<script src="js/news_ticker.js" type="text/javascript"></script>

该代码的代码如下:

$(document).ready(function () {

    var first = 0;
    var speed = 800;
    var pause = 3500;

    function removeFirst() {
        first = $('ul#listticker li:first').html();
        $('ul#listticker li:first')
.animate({ opacity: 0, height: "0px" }, speed, 'linear', function () { $(this).remove(); });
        addLast(first);
    }

    function addLast(first) {
        last = '<li style="display:none">' + first + '</li>';
        $('ul#listticker').append(last)
        $('ul#listticker li:last')
.animate({ opacity: 1, height: "auto" }, speed)
.fadeIn('slow')
    }
        interval = setInterval(removeFirst, pause);
});

为什么我的自动收报机根本没有滚动?

1 个答案:

答案 0 :(得分:1)

您的自动收报机工作正常,也许您的jQuery库版本已经过时了。我用jQuery v2.0.3测试它