我使用了codepen https://codepen.io/dfitzy/pen/xZqGVo的幻灯片,但我无法更改这些点来更改幻灯片。我想在点周围添加黑色边框。当我尝试它,它使矩形。为了节省您的时间,这是带有点" a.slide_btn"的课程。 我知道它的东西很少,但我无法弄清楚是什么。
$('.slider').each(function() {
var $this = $(this);
var $group = $this.find('.slide_group');
var $slides = $this.find('.slide');
var bulletArray = [];
var currentIndex = 0;
var timeout;
function move(newIndex) {
var animateLeft, slideLeft;
advance();
if ($group.is(':animated') || currentIndex === newIndex) {
return;
}
bulletArray[currentIndex].removeClass('active');
bulletArray[newIndex].addClass('active');
if (newIndex > currentIndex) {
slideLeft = '100%';
animateLeft = '-100%';
} else {
slideLeft = '-100%';
animateLeft = '100%';
}
$slides.eq(newIndex).css({
display: 'block',
left: slideLeft
});
$group.animate({
left: animateLeft
}, function() {
$slides.eq(currentIndex).css({
display: 'none'
});
$slides.eq(newIndex).css({
left: 0
});
$group.css({
left: 0
});
currentIndex = newIndex;
});
}
function advance() {
clearTimeout(timeout);
timeout = setTimeout(function() {
if (currentIndex < ($slides.length - 1)) {
move(currentIndex + 1);
} else {
move(0);
}
}, 4000);
}
$('.next_btn').on('click', function() {
if (currentIndex < ($slides.length - 1)) {
move(currentIndex + 1);
} else {
move(0);
}
});
$('.previous_btn').on('click', function() {
if (currentIndex !== 0) {
move(currentIndex - 1);
} else {
move(3);
}
});
$.each($slides, function(index) {
var $button = $('<a class="slide_btn">•</a>');
if (index === currentIndex) {
$button.addClass('active');
}
$button.on('click', function() {
move(index);
}).appendTo('.slide_buttons');
bulletArray.push($button);
});
advance();
});
&#13;
html, body {
background: #F7F5E6;
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
.slider {
margin: 0 auto;
width:100%;
height:100%;
}
.slide_viewer {
height:100%;
height: 340px;
overflow: hidden;
position: relative;
}
.slide_group {
height: 100%;
position: relative;
width: 100%;
}
.slide {
display: none;
height: 100%;
position: absolute;
width: 100%;
}
.slide:first-child {
height:100%;
display: block;
}
.slide:nth-of-type(1) {
height:100%;
background: #D7A151;
}
.slide:nth-of-type(2) {
height:100%;
background: #F4E4CD;
}
.slide:nth-of-type(3) {
background: #C75534;
}
.slide:nth-of-type(4) {
height:100%;
background: #D1D1D4;
}
.slide_buttons {
left: 0;
position: absolute;
right: 0;
text-align: center;
}
a.slide_btn {
color: #474544;
font-size: 42px;
margin: 0 0.175em;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.slide_btn.active, .slide_btn:hover {
color: #428CC6;
cursor: pointer;
}
.directional_nav {
height: 340px;
margin: 0 auto;
max-width: 940px;
position: relative;
top: -340px;
}
.previous_btn {
bottom: 0;
left: 100px;
margin: auto;
position: absolute;
top: 0;
}
.next_btn {
bottom: 0;
margin: auto;
position: absolute;
right: 100px;
top: 0;
}
.previous_btn, .next_btn {
cursor: pointer;
height: 65px;
opacity: 0.5;
-webkit-transition: opacity 0.4s ease-in-out;
-moz-transition: opacity 0.4s ease-in-out;
-ms-transition: opacity 0.4s ease-in-out;
-o-transition: opacity 0.4s ease-in-out;
transition: opacity 0.4s ease-in-out;
width: 65px;
}
.previous_btn:hover, .next_btn:hover {
opacity: 1;
}
@media only screen and (max-width: 767px) {
.previous_btn {
left: 50px;
}
.next_btn {
right: 50px;
}
}
&#13;
<div class="slider">
<div class="slide_viewer">
<div class="slide_group">
<div class="slide">
</div>
<div class="slide">
</div>
<div class="slide">
</div>
<div class="slide">
</div>
</div>
</div>
</div><!-- End // .slider -->
<div class="slide_buttons">
</div>
</div><!-- End // .directional_nav -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
&#13;
答案 0 :(得分:1)
实际上,在那里使用的圆圈是符号,就像字母一样。当你给a.slide_btn
边框时,它基本上给了a
的边界,a.slide_btn
是字母(符号)的容器。实际上你有两种方法,第一种方式是以svg格式绘制自定义圆,就像滑块中使用的下一个和上一个按钮一样。但是如果你想要一些简单的东西,你可以给包含那些圆圈的a.slide_btn {
color: #428CC6;
font-size: 200px;
text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
}
提供文字阴影。
<a class="slide_btn">•</a>
from tkinter import *
import sqlite3
from functools import partial
def query(x):
conn = sqlite3.connect("_db")
cur = conn.cursor()
q = cur.execute("SELECT text, option1, option2, option3 FROM tbl_1 WHERE id=?", [x, ])
actions = q.fetchone()
return actions
def pkey(identifier, label):
q = query(identifier)
buttons = {}
text = q[0]
label.config(text=text)
for entry in q:
if entry != text and entry is not None:
buttons[int(entry[0])] = entry[3:]
new_button = Button(root)
for k, v in buttons.items():
new_button.config(text=v, command=partial(pkey, k, label))
new_button.pack(fill=X)
print(buttons)
lbl.pack()
root = Tk()
root.geometry("300x200")
text_frame = LabelFrame(root, bg="#A66D4F")
text_frame.pack(fill=BOTH, expand=Y)
options_frame = LabelFrame(root, bg="cyan").pack(fill=X)
lbl = Label(text_frame)
pkey(1, lbl)
root.mainloop()