|
@@ -108,10 +108,16 @@ function detectBrowser(agent) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 範圍內取隨機整數(0-8)
|
|
|
+function getRandomInt(max) {
|
|
|
+ return Math.floor(Math.random() * max);
|
|
|
+}
|
|
|
+
|
|
|
function renderSec00(data) {
|
|
|
let temp = data[0]["data"];
|
|
|
renderBullet(temp);
|
|
|
renderBannerStr("sec-00-slider", temp);
|
|
|
+ let randomInt = getRandomInt(7);
|
|
|
$(".sec-00-slider").slick({
|
|
|
dots: false,
|
|
|
infinite: true,
|
|
@@ -120,6 +126,7 @@ function renderSec00(data) {
|
|
|
autoplaySpeed: 3000,
|
|
|
slidesToScroll: 1,
|
|
|
arrows: false,
|
|
|
+ initialSlide: randomInt, // 起始順序
|
|
|
prevArrow:
|
|
|
'<button type="button" class="slick-prev"><i class="fas fa-chevron-left" style="font-size: 32px;color: white;transform: translateY(-10px);"></i></button>',
|
|
|
nextArrow:
|
|
@@ -176,11 +183,7 @@ function renderBanner(data) {
|
|
|
|
|
|
$(`.banner-slider`).html(str);
|
|
|
|
|
|
- // 範圍內取隨機整數(0-8)
|
|
|
- function getRandomInt(max) {
|
|
|
- return Math.floor(Math.random() * max);
|
|
|
- }
|
|
|
- let randomInt = getRandomInt(9);
|
|
|
+ let randomInt = getRandomInt(8);
|
|
|
|
|
|
// 輪播設定
|
|
|
$('.banner-slider').slick({
|