【问题标题】:Display Problems With Arrows on Nivo SliderNivo 滑块上的箭头显示问题
【发布时间】:2013-11-22 21:39:42
【问题描述】:

我决定进行下一次跳跃式 Web 开发,我想我会使用 Nivoslider。

我无法显示箭头!尽管它们是不可见的,但它们确实有效 - 在进入下一张和上一张幻灯片时。

这是我的 NIVO CSS 代码:

    /* Nivo Slider Starts CSS starts Here */

.nivoSlider {
    position:relative;
    width:95%;
    height:auto;
    overflow: hidden;
}
.nivoSlider img {
    position:absolute;

    max-width: none;
}
.nivo-main-image {
    display: block !important;
    height: auto !important;

}

/* If an image is wrapped in a link */
.nivoSlider a.nivo-imageLink {
    position:absolute;
    top:0px;
    left:0px;
    width:100%;
    height:100%;
    border:0;
    padding:0;
    margin:0;
    z-index:6;
    display:none;
    background:white; 
    filter:alpha(opacity=0); 
    opacity:0;
}
/* The slices and boxes in the Slider */
.nivo-slice {
    display:block;
    position:absolute;
    z-index:5;
    height:100%;
    top:0;
}
.nivo-box {
    display:block;
    position:absolute;
    z-index:5;
    overflow:hidden;
}
.nivo-box img { display:block; }

/* Caption styles */
.nivo-caption {
    position:absolute;
    left:0px;
    bottom:40px;
    background:#000;
        height:30px;
    color:#fff;
    width:100%;
    z-index:8;
    padding: 5px 10px;
    opacity: 0.5;
    overflow: hidden;
    display: none;
    -moz-opacity: 0.8;
    filter:alpha(opacity=8);
    -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
    -moz-box-sizing: border-box;    /* Firefox, other Gecko */
    box-sizing: border-box;         /* Opera/IE 8+ */
}
.nivo-caption p {
    padding:5px;
    margin:0;
}
.nivo-caption a {
    display:inline !important;
}
.nivo-html-caption {
    display:none;
}
/* Direction nav styles (e.g. Next & Prev) */
.nivo-directionNav a {
    position:absolute;
    top:45%;
    z-index:1000;
    cursor:pointer;
        display:block;
        height: 30px;
        width: 30px;
        text-indent:9999px;
        background: url(arrows_1.png);
        background-repeat:no-repeat;
        opacity: 1; /* NEW */ 
        -webkit-transition: all 200ms ease-in-out; 
        -moz-transition: all 200ms ease-in-out; 
        -o-transition: all 200ms ease-in-out; 
            transition: all 200ms ease-in-out; 

}
a.nivo-prevNav {
    left:15px;        
}
a.nivo-nextNav {
    right:15px;

}
/* Control nav styles (e.g. 1,2,3...) */
.nivo-controlNav {
    position: absolute;
     top:600px;
    padding: 15px 0;
        width:100px;
        float:right;


}
.nivo-controlNav a {
    cursor:pointer;
}
.nivo-controlNav a.active {
    font-weight:bold;
}


/* Nivo Slider Ends CSS starts Here */
/

我尝试了很多不同的方法,但都没有奏效,现在我的大脑被炸了。

如果有任何帮助,我将不胜感激!非常感谢你们。 -PJ

【问题讨论】:

  • 您的图片路径错误。背景:url("arrows_1.png");
  • 嗯……可能是这样。但是如果是这种情况,您不会看到默认图像文件缺少箭头应该在的位置吗?
  • 图像不在图像文件夹中,它与 index.php 位于同一目录中。我像你上面一样添加了引号 - 仍然没有工作..
  • 正确的路径是这样的:url("../arrows_1.png");您应该学习如何在文件夹之间移动。
  • @Peege151 不,您不会看到“图像文件丢失”图像,因为它是在 CSS 中加载的。仅当您使用 <img src="broken-link" /> 没有 img 标记,没有“缺少图像文件”图像时才会显示。

标签: jquery html css nivo-slider


【解决方案1】:

浏览器告诉我没有名为“arrows_1.png”的文件。您的图像文件路径可能不正确。

.nivo-directionNav a {
    position:absolute;
    top:45%;
    z-index:1000;
    cursor:pointer;
    display:block;
    height: 30px;
    width: 30px;
    text-indent:9999px;
        background: url(arrows_1.png);//here is the error.
    background-repeat:no-repeat;
    opacity: 1; /* NEW */ 
    -webkit-transition: all 200ms ease-in-out; 
    -moz-transition: all 200ms ease-in-out; 
    -o-transition: all 200ms ease-in-out; 
    transition: all 200ms ease-in-out;  
}

【讨论】:

  • 这是您的 CSS 使用的 URL。 emmymudgemusic.com/CSS/arrows_1.png你需要将URL改为`background: url('/arrows_1.png');
  • 没错。在 CSS 中,它与 CSS 所在的位置相关,而不是 PHP 文件。如果您的 CSS 在页面中的 <style> 标记中,则它来自该页面,但如果您链接到 css 文件则不是。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-11
  • 1970-01-01
相关资源
最近更新 更多