【问题标题】:nivoSlider undefined resourcesnivoSlider 未定义资源
【发布时间】:2012-04-12 02:11:12
【问题描述】:

我正在尝试让 nivoSlider 在此站点 http://fritech.co.uk/ 上工作,其中包含三个图像

<div id="slideshow" class="section theme-nivo">
    <div class="ribbon"></div>
    <div class="nivoSlider">
        <img src="static/img/logos.png" alt="Our inhouse skills" />
        <img src="static/img/atlanta.png" alt="Modern technologies" />
        <img src="static/img/boston.png" alt="Ruggedly tested software" />
    </div>
</div>

但是 nivoSlider 只显示其中之一,始终显示在顶部。我不确定这里出了什么问题。任何帮助将不胜感激。

【问题讨论】:

  • 你可以用开发版本更改 static/js/libs/jquery.nivo.slider.pack.js 吗?这将使调试变得容易得多。
  • @helmus 现在完成了。

标签: javascript jquery jquery-plugins slideshow nivo-slider


【解决方案1】:

有关您的情况的文档,

我刚遇到类似的情况,“k is not defined”..

恰好是img 标记中缺少title 属性

<img title="" src="http://placehold.it/260x180" alt="Our inhouse skills" />

【讨论】:

    【解决方案2】:

    找到了!

    请改一下

    <div id="slideshow" class="section theme-nivo">
        <div class="ribbon"></div>
        <div class="nivoSlider">
            <img src="static/img/logos.png" alt="Our inhouse skills" />
            <img src="static/img/atlanta.png" alt="Modern technologies" />
            <img src="static/img/boston.png" alt="Ruggedly tested software" />
        </div>
    </div>
    

    到这里:

    <div class="section theme-nivo">
        <div class="ribbon"></div>
        <div id="slideshow" class="nivoSlider">
            <img src="static/img/logos.png" alt="Our inhouse skills" />
            <img src="static/img/atlanta.png" alt="Modern technologies" />
            <img src="static/img/boston.png" alt="Ruggedly tested software" />
        </div>
    </div>  
    

    NivoSlider 期望顶部元素的所有子元素都是图像,如果元素不是图像,它将查找它可以在该元素中找到的第一个图像。 (见这里)

    这就是为什么您会得到一个未定义图像和徽标图像的循环。 因为ribbon元素不包含任何图片,而nivoSlider元素的第一张图片就是logo。

    【讨论】:

      【解决方案3】:

      您的问题是您将 #slideshow id 添加到 html 中的错误容器中:

      <div id="top" class="bordered-section">
          <div id="slideshow" class="section theme-nivo">
              <div class="ribbon"></div>
              <div class="nivoSlider">
      
                  <img src="http://placehold.it/260x180" alt="Our inhouse skills" />
                  <img src="http://placehold.it/260x180" alt="Modern technologies" />
                  <img src="http://placehold.it/260x180" alt="Ruggedly tested software" />
              </div>
          </div>
      </div>
      

      ID 应放置在用作背景图像的图像容器上。

      固定。

      <div id="top" class="bordered-section">
          <div class="section theme-nivo">
              <div class="ribbon"></div>
              <div id="slideshow" class="nivoSlider">
      
                  <img src="http://placehold.it/260x180" alt="Our inhouse skills" />
                  <img src="http://placehold.it/260x180" alt="Modern technologies" />
                  <img src="http://placehold.it/260x180" alt="Ruggedly tested software" />
              </div>
          </div>
      </div>
      

      你可以在插件Documentation下找到正确的用法。

      【讨论】:

      • @Meitham,我先回答,我给出了出错的确切原因(按照你的要求),我昨天已经在看这个了,为什么我没有得到赏金?
      • @helmus 感谢您为回答这个问题所做的努力。您的回答同样出色,但是我发现对文档 andres-ilich put 的引用是额外的奖励。如果有办法将赏金分配给你们两个,我会这样做的。我还对您的问题进行了投票以给予加分。
      【解决方案4】:

      我有同样的问题尝试将您的 js 更改为此 http://pastebin.com/7QPV2rgr

      【讨论】:

      【解决方案5】:

      出了点问题,也许您正在请求服务器或该文件夹中不存在的图像。因为在 Firefox 控制台 (FireBug) 它抛出了这个 error

      未定义 "NetworkError: 404 Not Found - http://fritech.co.uk/undefined"

      否则一切看起来都很好。请仔细检查您尝试在滑块中加载的图像。

      希望这会有所帮助。

      【讨论】:

      • 图片都在那里。如果您确实查看源代码并单击它们将打开的链接。但是,nivoSlider 将图像路径返回为未定义,导致 404。
      • 能否请您在设置中将 controlNavThumbsFromRel 设置为“false”,然后试一试。
      • 那行不通。我还将图像路径设置为绝对路径,但仍然失败。
      猜你喜欢
      • 1970-01-01
      • 2016-07-19
      • 2017-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-30
      • 2022-07-19
      相关资源
      最近更新 更多