如何为Galleria大图添加边框?

时间:2010-11-02 12:09:43

标签: javascript jquery css jquery-plugins galleria

您好我想为Galleria大图添加边框。我该怎么办呢?

我这样付出

div.galleria-image img{ border: 5px solid #ccc; }

但它会切割右边框或下边框,并且还会显示缩略图图像的顶部边框。

这是我的css文件。

.galleria-container{position:relative;overflow:hidden; height:570px; margin-bottom:30px; }
.galleria-thumbnails-container { }
.galleria-container img{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;}
.galleria-stage{position:absolute;top:10px;bottom:80px;left:0px;right:10px;overflow:hidden;}
div.galleria-stage img { border: 1px solid red; }
.galleria-thumbnails-container{height:65px;bottom:0;position:absolute;left:0px;right:10px;z-index:2;}
.galleria-carousel .galleria-thumbnails-list{margin-left:30px;margin-right:30px;}
.galleria-thumbnails .galleria-image{height:50px;width:60px;background:#fff;margin:0 13px 0 0; float:left;cursor:pointer;}
.galleria-counter{position:absolute;bottom:10px;left:10px;text-align:right;color:#fff;font:normal 11px/1 arial,sans-serif;z-index:2; }
.galleria-loader{background:#000;width:20px;height:20px;position:absolute;top:10px;right:10px;z-index:2;display:none;background:url(images/classic-loader.gif) no-repeat 2px 2px; }
.galleria-info{width:50%;top:15px;left:15px;z-index:2;position:absolute;}
.galleria-info-text{background-color:#000;background-color:rgba(0,0,0,.9);padding: 12px;display:none;}
.galleria-info-title{font:bold 12px/1.1 arial,sans-serif;margin:0;color:#fff;}
.galleria-info-description{font:italic 12px/1.4 georgia,serif;margin:0;color:#bbb; }
.galleria-info-title+.galleria-info-description{margin-top:7px;}
.galleria-info-close{width:9px;height:9px;position:absolute;top:5px;right:5px;background-position:-753px -11px;opacity:.5;cursor:pointer;display:none;}
.galleria-info-link{background-position:-669px -5px;opacity:.8;position:absolute;width:20px;height:20px;cursor:pointer;background-color:#000;}
.galleria-info-link:hover,
.galleria-info-close:hover{opacity:.5; }
.galleria-image-nav{position:absolute;top:50%;margin-top:-15px;width:100%;height:31px;left:0; }
.galleria-image-nav-left,
.galleria-image-nav-right{opacity:.7;cursor:pointer;width:16px;height:31px;position:absolute;left:10px;z-index:2;}
.galleria-image-nav-right{left:auto;right:10px;background-position:-300px 0;z-index:2;}
.galleria-image-nav-left:hover,
.galleria-image-nav-right:hover{opacity:1.0;}
.galleria-thumb-nav-left,
.galleria-thumb-nav-right{cursor:pointer;display:none;background-position:-495px 11px;position:absolute;left:0;top:0;height:60px;width:23px;z-index:3;opacity:1.0;}
.galleria-thumb-nav-right{background-position:-578px 11px;border-right:none;right:0;left:auto;}
.galleria-thumbnails-container .disabled,
.galleria-thumbnails-container .disabled:hover{opacity:.6;cursor:default; }
.galleria-thumb-nav-left:hover,
.galleria-thumb-nav-right:hover{opacity:1;/*background-color:#111;*/}
.galleria-carousel .galleria-thumb-nav-left,
.galleria-carousel .galleria-thumb-nav-right{display:block; }
.galleria-thumb-nav-left,
.galleria-thumb-nav-right,
.galleria-info-link,
.galleria-info-close,
.galleria-image-nav-left,
.galleria-image-nav-right{background-image:url(images/classic-map.png);background-repeat:no-repeat;}
div.galleria-image img{ border: 5px solid #ccc; }

任何机构都知道解决方案请帮助我。

5 个答案:

答案 0 :(得分:2)

尝试将border: 1px solid red;添加到div.galleria-image img

  

div.galleria-image img {border:1px   纯红色; }

编辑:看起来像上面的CSS会导致缩略图也有边框。

试试这个:

  

div.galleria-stage img {border:1px solid red; }

答案 1 :(得分:2)

当你调用galleria()时,将image_margin选项设置为2(注意:当我尝试1时,底部边距被切断)。这就是我使用的:

$('#gallery').galleria({
    autoplay: 5000,
    data_source: slides,
    pause_on_interaction: false,
    transition: 'fade',
    image_margin: 2
});

我网站的css文件具有以下定义,可为大图像添加1px灰色边框:

.galleria-stage img {     border:1px solid #cccccc; }

答案 2 :(得分:0)

你需要显示父div的溢出我有这个问题,我添加了它,它工作得很好 .galleria-container { overflow: visible !important; } .galleria-image, .galleria-stage { overflow: visible !important; } .galleria-stage .galleria-images .galleria-image img { border: 1px solid #333333; }

答案 3 :(得分:0)

似乎需要将imageMargin选项设置为应该的两倍。

http://galleria.io/docs/options/imageMargin/

就像我一直试图在它周围放一个6px的边框,底部不断被切断,直到我将imageMargin设置为12。

答案 4 :(得分:0)

如果您的边框是例如4像素,那么您应该将image_margin变量设置为8,如果边框是8px,则将其设置为16(双倍,因为您有两边)。

$('#gallery').galleria({
    image_margin: 8
});