пятно официальное
Я настроил точечную навигацию пятна и сделал его изображением.
И это должно было быть так:
![button](https://i.stack.imgur.com/zHY7U.jpg)
Но сейчас
упс
Изображение active
должно было быть уменьшено вдвое, но оно не уменьшается ..
В инструменте разработчика это было загадочное число 10px
, для которого не было установлено значение width
или height
.
Как я могу лишить законной силы этот таинственный 10px
?
код slick.js (ссылка на код github)
DOM, который, кажется, связан:
![in developer tool](https://i.stack.imgur.com/5iAdU.png)
На мой взгляд, при наведении
![like this](https://i.stack.imgur.com/LWgWz.png)
Я хочу, чтобы это было похоже на это.
Я вставил внутри черную кнопку в ::before
и поиграл opacity
с :hover
, но на моем пути не осталось внешней кнопки ..
Как сделать прозрачность такой, когда кнопка insideBlack имеет значение hover
, оставляя внешнюю кнопку нетронутой?
Мой код
CSS
.pxradio {
position: absolute;
bottom: -55px;
list-style: none;
display: block;
text-align: center;
padding: 0;
margin: 0;
width: 100%;
}
.pxradio li {
position: relative;
display: inline-block;
margin: 0 10px;
padding: 0;
cursor: pointer;
}
.pxradio li button {
text-indent: -9999px;
border: 0;
background: url("../img/radio-outside.svg");
display: block;
height: 9px;
width: 9px;
outline: none;
padding: 5px;
cursor: pointer;
}
.pxradio li button:hover, .pxradio li button:focus {
outline: none;
}
.pxradio li.slick-active button {
background: url("../img/radio-insideBlack.svg");
width: 4.5px;
height: 4.5px;
opacity: 1;
}
JQuery
$(function(){
$('#carousel').slick({
dotsClass: 'pxradio',
});
});
Наконец
Большое спасибо!
Слегка настроенный, и в итоге это выглядело так.
Небольшое отклонение черного круга может быть исправлено на backface-visibility: hidden;
.
.pxradio li button {
position: relative; /* Add */
text-indent: -9999px;
border: 0;
background: url("../img/pxradio-n.svg"); /* =radio-outside.svg */
display: block;
height: 9px;
width: 9px;
outline: none;
padding: 5px;
cursor: pointer;
}
.pxradio li button:hover, .pxradio li button:focus {
outline: none;
}
.pxradio li button::before { /* ▼ Add everything from here */
position: absolute;
content: '';
background-image: url("../img/pxradio-c.svg"); /* =radio-insideBlack.svg */
background-repeat: no-repeat;
background-position: center;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 3.5px;
height: 3.5px;
opacity: 0;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.pxradio li button:hover::before {
opacity: .2;
}
.pxradio li.slick-active button {
background: url("../img/pxradio-n.svg"), url("../img/pxradio-c.svg");
background-size: 10px, 4.5px;
background-repeat: no-repeat;
background-position: center, center;
pointer-events: none;
}