【问题标题】:Ticker problems, wont load in motion, just displays all text. jquery ajax股票代码问题,不会在运动中加载,只显示所有文本。 jQuery ajax
【发布时间】:2014-02-14 12:46:15
【问题描述】:

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

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>

任何想法为什么它只显示下划线_这样?它让我头疼!

谢谢

【问题讨论】:

  • 你的 jQuery 库包含在哪里?
  • 我把它放在页面的上方,我现在把它放在 jquery.ticker.js 下面,我在脚本中使用 googleapi jquery。

标签: javascript jquery html ticker news-ticker


【解决方案1】:

请在&lt;head&gt; 标签中包含您的以下脚本/css,它应该可以工作。

<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>

您可能还需要将以下 js 代码从您的 &lt;div&gt; 中移出。检查这是否解决了其余问题。

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

【讨论】:

  • 这部分解决了它:) 谢谢!现在弄清楚为什么它不加载我的信息! :D
  • 恐怕运气不好。它没有区别,但现在我的整个页面没有加载任何 jquery。一定是某个地方发生了冲突!
【解决方案2】:

我发现将代码脚本放入单独的 .js 文件中可以完美运行。

把它拿出来:

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

并将其放入自己的 .js 文件中并调用它使其可以为我工作。

【讨论】:

    猜你喜欢
    • 2012-05-05
    • 1970-01-01
    • 2017-05-07
    • 2013-01-04
    • 1970-01-01
    • 1970-01-01
    • 2014-10-16
    • 2011-01-23
    • 2014-10-09
    相关资源
    最近更新 更多