0

我是在制作新闻自动收报机之后,这是我第一次看到这个网站。

http://www.jquerynewsticker.com/

我把代码全部设置成这样

 <div class="news_ticker"><link href="LPMS\production_scn\jquery_news_ticker\styles\ticker-style.css" rel="stylesheet" type="text/css" />
                    <script src="LPMS\production_scn\jquery_news_ticker\includes\jquery.ticker.js" type="text/javascript"></script>
              <ul id="js-news" class="js-hidden">
                <li class="news-item"><a href="#">This is the 1st latest news item.</a></li>
                <li class="news-item"><a href="#">This is the 2nd latest news item.</a></li>
                <li class="news-item"><a href="#">This is the 3rd latest news item.</a></li>
                <li class="news-item"><a href="#">This is the 4th latest news item.</a></li>
                </ul>


            <script type="text/javascript">
            $(function () {
            $('#js-news').ticker();
            });
            </script>


               </div>

我假设这一切都在 1 div 中?它简单地列出了最新项目新闻而不是滚动或任何东西,它几乎就像它没有拿起 jquery 但我已经扎根它来找到源头,任何人都可以为我阐明这一点吗?

编辑/更新

多亏了Java_User,我设法让它有点工作,现在我的问题是它不会显示我要求它输出的内容,即使我更改文本/输入它也只显示一行。

我现在的代码是..这是在头脑中

<link href="/LPMS/production_scn/jquery_news_ticker/styles/ticker-style.css" rel="stylesheet" type="text/css" />
<script src="/LPMS/production_scn/jquery_news_ticker/includes/jquery.ticker.js" type="text/javascript"></script>
</head>

这是在页面的底部(页面的其余部分是空的,以避免任何冲突!)

<div class="clear_line"></div>
 <script type="text/javascript">
    $(function () {
        $('#js-news').ticker();
    });
</script>

<!-- News Feed ticker  - use jquery to scroll ticker!! -->
<div class="news_feed">
    <img src="/LPMS/images/news/breaking_news.png" style="border-style:none;">
   <div class="news_ticker"><ul id="js-news" class="js-hidden">
    <li class="news-item"><a href="#">This is the 1st latest news item.</a></li>
    <li class="news-item"><a href="#">This is the 2nd latest news item.</a></li>
    <li class="news-item"><a href="#">This is the 3rd latest news item.</a></li>
    <li class="news-item"><a href="#">This is the 4th latest news item.</a></li>
    </ul> </div></div>


</div>

any ideas why it displays just an underscore _ like that? its doing my head in!

thanks

4

2 回答 2

0

Please include your below scripts/css inside your <head> tag and it should work.

<link href="LPMS\production_scn\jquery_news_ticker\styles\ticker-style.css" rel="stylesheet" type="text/css" />
<script src="LPMS\production_scn\jquery_news_ticker\includes\jquery.ticker.js" type="text/javascript"></script>

You may need to move the below js code out of your <div> as well. Check if this solves rest issue.

<script type="text/javascript">
            $(function () {
            $('#js-news').ticker();
            });
            </script>
于 2014-02-14T12:49:48.987 回答
0

i found that putting the ticker script into a seperate .js file works flawlessly.

taking this out:

  <script type="text/javascript">
            $(function () {
            $('#js-news').ticker();
            });
            </script>

and putting it into its own .js file and calling it has allowed it to work for me.

于 2014-02-19T11:45:53.940 回答