Slick.js删除图像周围的蓝色突出显示

时间:2015-09-08 22:47:52

标签: javascript jquery css slick.js

我正在使用Slick.js在模态中构建旋转木马。一切都很完美,直到我点击图像。出现蓝色边框,遗憾的是我无法弄清楚如何让它停止这样做。我试过了大纲:没有和边界:没有,没有成功。这是我的代码

HTML:

<div id="openModal" class="modalDialog">
    <div id ="background">
        <a href="#close" title="Close" class="close">X</a>
            <div id="logo">
                <img src="/media/{{ gallery.logo }}" alt="Smiley face" height="100" width="150">
            </div>
            <div class="multiple-items">
                        <div><img src="/media/{{ gallery.image1 }}" height="200" width="300"></div>
                        <div><img src="/media/{{ gallery.image2 }}" height="200" width="300"></div>
                        <div><img src="/media/{{ gallery.image3 }}" height="200" width="300"></div>
                        <div><img src="/media/{{ gallery.image4 }}" height="200" width="300"></div>
                        <div><img src="/media/{{ gallery.image5 }}" height="200" width="300"></div>
                        <div><img src="/media/{{ gallery.image6 }}" height="200" width="300"></div>
            </div>
        </div>
</div>

CSS:

/* Slider */
 .slick-slider {
    margin: 110px 35px 0 0;
    position: relative;
    display: block;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -khtml-user-select: none;
    -ms-touch-action: pan-y;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}
.slick-list {
    position: relative;
    display: block;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.slick-list:focus {
    outline: none;
}
.slick-list.dragging {
    cursor: pointer;
    cursor: hand;
}
.slick-slider .slick-track, .slick-slider .slick-list {
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}
.slick-track {
    position: relative;
    top: 0;
    left: 0;
    display: block;
}
.slick-track:before, .slick-track:after {
    display: table;
    content:'';
}
.slick-track:after {
    clear: both;
}
.slick-loading .slick-track {
    visibility: hidden;
}
.slick-slide {
    display: none;
    float: left;
    height: 100%;
    min-height: 1px;
}
[dir='rtl'] .slick-slide {
    float: right;
}
.slick-slide img {
    display: block;
}
.slick-slide.slick-loading img {
    display: none;
}
.slick-slide.dragging img {
    pointer-events: none;
}
.slick-initialized .slick-slide {
    display: block;
    background-color: green;
    border: none;
}
.slick-loading .slick-slide {
    visibility: hidden;
}
.slick-vertical .slick-slide {
    display: block;
    height: auto;
    border: 1px solid transparent;
}
.slick-arrow.slick-hidden {
    display: none;
}
.slider {
    width: 80%;
    margin: 40px 0 0 100px;
}
.lower {
    margin-top: 100px;
}
.slick-slide {
    color: white;
    padding: 30px;
    font-size: 30px;
    font-family:"Arial";
    margin: 0 -50px 0 0;
}
.slick-prev:before, .slick-next:before {
    color: black;
}
.slick-slide:nth-child(1), .slick-slide:nth-child(3), .slick-slide:nth-child(5), .slick-slide:nth-child(7), .slick-slide:nth-child(9), .slick-slide:nth-child(11) {
}
.slick-slide slick-current slick-active {
    display: none;
    color: red;
}
.slick-slide slick-active {
    display: none;
}
.slick-active img {
    outline: 0 !important;
    border:0 none !important;
}
.multiple-items img {
    outline: 0 !important;
    border:0 none !important;
}

JQuery的:

$(document).ready(function(){
    $('.multiple-items').slick({
      infinite: false,
      arrows: false,
      slidesToShow: 3,
      slidesToScroll: 1,

});
  });

编辑:

以下是JSFiddle的链接。打开模态时,您将看到里面的图像。单击图像后,图像周围会出现一个蓝色框。这就是我想要删除的内容。

7 个答案:

答案 0 :(得分:38)

您需要使用outline: none;

将其放在.slick-slide

.slick-slide {
    outline: none
}

Demo

答案 1 :(得分:4)

要使 Div 上的反应流畅,导致出现轮廓的解决方案是:

.slick-slide div {
  outline: none;
 }

答案 2 :(得分:2)

试试这个对我有用。您需要为光滑的滑块@RequestMapping("/novo") public ModelAndView novo() { ModelAndView mv = new ModelAndView(CADASTRO_VIEW); mv.addObject(new Pessoa()); return mv; } 标记

添加 /// <reference path='../../Scripts/typings/angularjs/angular.d.ts' /> /// <reference path='../../Scripts/typings/jquery/jquery.d.ts' /> 'use strict' interface IRouteParams extends ng.route.IRouteParamsService { propertyAddress: string; } class Controller1 { public propertyAdd: string; constructor($scope: any, $routeParams: IRouteParams, ServicesFactory, growl, blockUI, IMAGE_RELATED_MESSAGES, BUSY_MESSAGES, $timeout: ng.ITimeoutService, $modal, Lightbox, $filter) { this.propertyAdd = $routeParams.propertyAddress; } } angular.module('Controller').controller('Controller1', Controller1);
outline: none;

答案 3 :(得分:1)

我用:

.slick-slide,.slick-slide * {大纲:无!重要; }

答案 4 :(得分:0)

您是否尝试将此添加到您的img标签中?: style =&#34; border-style:none&#34; / 试试看,看看它是否有效。

答案 5 :(得分:0)

如果您使用的是bootstrap,请注意该代码中的a:focus设置也会导致出现蓝色边框。如果您将光滑幻灯片设置为!important或将引导代码更改为:focus:none; ,这将解决它。

答案 6 :(得分:0)

如果您要将反应组件传递到光滑的转盘中,即

<Slider {...settings}>
 <CarouselItem/>
</Slider>

我发现我必须将outline: none;样式应用于<CarouselItem/>组件,而不是针对任何本机slick-*类。