Skip to content

Commit a135d8a

Browse files
committed
1.3.0
1 parent 9c6d35e commit a135d8a

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
## 1.3.0
4+
5+
_2025-04-29_
6+
7+
- Simplified the slider syntax for easier usage.
8+
- Added customization options for button locations and colors.
9+
310
## 1.2.1
411

512
_2025-04-20_

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ To use the image slider, you need to include the plugin in your Docsify `index.h
3434
To create an image slider, you can use the following syntax in your markdown files:
3535

3636
```html
37-
<div class="image-slider">
38-
[[slider]](img url 1|img url 2|img url 3|...)
39-
</div>
37+
[[slider]](img url 1|img url 2|...|img url n)
4038
```
4139

4240
---
@@ -73,8 +71,10 @@ The slider can be customized using CSS. You can override the following CSS varia
7371
| `--docsify-image-slider-height` | Height of the slide. |
7472
| `--docsify-image-slider-max-width` | Maximum width of the slide. |
7573
| `--docsify-image-slider-overflow` | Overflow property for the slide. |
74+
| `--docsify-image-slider-left-right-margin` | Margin for the left and right sides of the slider buttons. |
7675
| `--docsify-image-slider-button-color` | Color of the slider arrows. |
7776
| `--docsify-image-slider-button-bg-color` | Background color of the slider buttons. |
77+
| `--docsify-image-slider-button-bg-hover-color` | Background color of the slider buttons on hover. |
7878
| `--docsify-image-slider-button-border-color` | Border color of the slider buttons. |
7979

8080
To change the transition effect and the size of the slider, you can add the following styles to your `index.html` file:
@@ -88,10 +88,12 @@ To change the transition effect and the size of the slider, you can add the foll
8888
--docsify-image-slider-height: 50vh;
8989
--docsify-image-slider-max-width: 768px;
9090
--docsify-image-slider-overflow: hidden;
91+
--docsify-image-slider-left-right-margin: -3rem;
9192
9293
/* slider-buttons */
9394
--docsify-image-slider-button-color: #a0a0a0;
9495
--docsify-image-slider-button-bg-color: transparent;
96+
--docsify-image-slider-button-bg-hover-color: #a0a0a01A;
9597
--docsify-image-slider-button-border-color: #a0a0a0;
9698
}
9799
</style>

src/slider.js

+20-18
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,27 @@ window.$docsify.plugins = (window.$docsify.plugins || []).concat((hook, vm) => {
1717
}).join('\n');
1818

1919
return string.replace(
20-
string, `<div class="slider-wrapper">
21-
<button class="slider-buttons" id="prev-slide">
22-
<i class="fas fa-arrow-left"></i>
23-
</button>
24-
<div class="slider">
25-
<div class="slide current"></div>
26-
${imageUrls.map((url, index) => {
27-
console.log(index)
28-
console.log(imageUrls.length)
29-
if (index === 0) {
30-
return "";
31-
} else {
32-
return `<div class="slide"></div>`;
33-
}
34-
}).join('')}
20+
string, `<div class="image-slider">
21+
<div class="slider-wrapper">
22+
<button class="slider-buttons" id="prev-slide">
23+
<i class="fas fa-arrow-left"></i>
24+
</button>
25+
<div class="slider">
26+
<div class="slide current"></div>
27+
${imageUrls.map((url, index) => {
28+
console.log(index)
29+
console.log(imageUrls.length)
30+
if (index === 0) {
31+
return "";
32+
} else {
33+
return `<div class="slide"></div>`;
34+
}
35+
}).join('')}
36+
</div>
37+
<button class="slider-buttons" id="next-slide">
38+
<i class="fas fa-arrow-right"></i>
39+
</button>
3540
</div>
36-
<button class="slider-buttons" id="next-slide">
37-
<i class="fas fa-arrow-right"></i>
38-
</button>
3941
</div>`
4042
);
4143
});

src/stylesheet.css

+5-15
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
--docsify-image-slider-height: 50vh;
66
--docsify-image-slider-max-width: 768px;
77
--docsify-image-slider-overflow: hidden;
8+
--docsify-image-slider-left-right-margin: -3rem;
89

910
/* slider-buttons */
1011
--docsify-image-slider-button-color: #a0a0a0;
1112
--docsify-image-slider-button-bg-color: transparent;
13+
--docsify-image-slider-button-bg-hover-color: #a0a0a01A;
1214
--docsify-image-slider-button-border-color: #a0a0a0;
1315
}
1416

@@ -29,6 +31,7 @@
2931
height: var(--docsify-image-slider-height);
3032
max-width: var(--docsify-image-slider-max-width);
3133
overflow: var(--docsify-image-slider-overflow);
34+
margin: 0 var(--docsify-image-slider-left-right-margin);
3235
flex-shrink: 0;
3336
}
3437

@@ -73,19 +76,6 @@ button.slider-buttons {
7376
margin: 0 1rem;
7477
}
7578

76-
@media {
77-
.slide .content {
78-
left: -80%;
79-
width: 80%;
80-
padding: 2rem;
81-
line-height: 1.6;
82-
}
83-
84-
.slide .content h1 {
85-
font-size: 2rem;
86-
}
87-
88-
.slide.current .content {
89-
transform: translateX(80%);
90-
}
79+
button.slider-buttons:hover {
80+
background-color: var(--docsify-image-slider-button-bg-hover-color);
9181
}

0 commit comments

Comments
 (0)