Skip to content

Commit 55089cb

Browse files
committed
[fix] display css bonus btn
1 parent bf659f7 commit 55089cb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css' integrity='sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA==' crossorigin='anonymous'/>
1414

1515
<!-- CUSTOM CSS -->
16-
<link rel="stylesheet" href="./css/style.css">
16+
<link rel="stylesheet" href="">
1717

1818
<title>Carosello Mono Array</title>
1919
</head>

js/script.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@ const msThumbs = document.querySelector('.ms-thumbnails');
44
const msBtnFwd = document.querySelector('.ms-slider-controller.forward');
55
const msBtnBwd = document.querySelector('.ms-slider-controller.backward');
66
const msBtnCss = document.querySelector('.ms-wrapper .css-btn');
7-
const basicCss = "http://127.0.0.1:5500/css/style.css";
8-
const bonusCss = "http://127.0.0.1:5500/css/style-bonus.css";
7+
const basicCss = "./css/style.css";
8+
const bonusCss = "./css/style-bonus.css";
9+
let displayBonus = false;
910

1011
const cssLink = document.getElementsByTagName('link');
1112

13+
cssLink[3].href = basicCss;
14+
1215
msBtnCss.addEventListener('click', function(){
13-
if (cssLink[3].href === basicCss){
16+
if (!displayBonus){
1417
msBtnCss.innerHTML = 'display basic style';
1518
cssLink[3].href = bonusCss;
19+
displayBonus = !displayBonus;
1620
} else{
1721
msBtnCss.innerHTML = 'display bonus style';
1822
cssLink[3].href = basicCss;
23+
displayBonus = !displayBonus;
1924
}
2025
});
2126

22-
console.log(cssLink[3], msBtnCss, (cssLink[3].href === basicCss));
27+
console.log(cssLink[3], msBtnCss);
2328

2429
let imgCounter = 0;
2530

0 commit comments

Comments
 (0)