Skip to content

Commit 164fdfb

Browse files
authored
Update index.html
1 parent 7680a65 commit 164fdfb

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

index.html

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,19 @@
391391
/* ✅ NEW: Diamond carousel layout stabilize */
392392
#diamond-sponsor-wrapper { display:block; }
393393
#diamond-sponsor-carousel { width:100%; max-width:520px; }
394-
#diamond-sponsor-carousel .diamond-slide { padding:10px 0; }
395-
#diamond-sponsor-carousel .owl-stage { display:flex; }
396-
#diamond-sponsor-carousel .owl-item { display:flex; }
397-
#diamond-sponsor-carousel .diamond-slide { width:100%; }
394+
#diamond-sponsor-carousel .owl-item{
395+
display:flex;
396+
justify-content:center;
397+
}
398+
#diamond-sponsor-carousel .diamond-slide{
399+
width:100%; /* 这一条可留也可不留,但不要去动 owl-stage */
400+
max-width:520px;
401+
}
402+
398403

399404

400405
/* ===== Pretty Owl Nav Arrows (Diamond) ===== */
401-
#diamond-sponsor-wrapper { position: relative; }
406+
#diamond-sponsor-wrapper { position: relative; overflow: visible;}
402407
#diamond-sponsor-carousel .owl-stage-outer{ overflow: visible; } /* 允许箭头露出来 */
403408

404409
#diamond-sponsor-carousel .owl-nav{
@@ -407,7 +412,9 @@
407412
left:0;
408413
right:0;
409414
transform:translateY(-50%);
410-
display:flex;
415+
display: flex !important;
416+
visibility: visible !important;
417+
opacity: 1 !important;
411418
justify-content:space-between;
412419
align-items:center;
413420
pointer-events:none; /* 让容器不挡点击 */
@@ -497,11 +504,7 @@
497504
}
498505
}
499506

500-
/* ✅ 防止外层裁剪箭头 */
501-
#diamond-sponsor-wrapper{ overflow: visible; }
502-
503-
504-
@media only screen and (max-width: 600px) {
507+
@media only screen and (max-width: 600px) {
505508
.circular-image {
506509
width: 120px;
507510
height: 120px;
@@ -1947,12 +1950,20 @@ <h3 style="font-size: 22px; color:#fff; margin:0;">
19471950
- 2+:每次显示 1 个 -->
19481951
<!-- ✅ Diamond carousel init (2+ slides -> carousel; 1 slide -> static) -->
19491952
<script>
1950-
jQuery(document).ready(function($){
1953+
jQuery(function($){
19511954
var $diamond = $('#diamond-sponsor-carousel');
19521955
if (!$diamond.length) return;
19531956

19541957
var slideCount = $diamond.children('.diamond-slide').length;
1955-
if (slideCount <= 1) return;
1958+
if (slideCount <= 1) return; // 只有1张就不启用轮播
1959+
1960+
// ✅ 防止被别的脚本初始化过(常见:home.js / main.js 里扫 .owl-carousel)
1961+
if ($diamond.hasClass('owl-loaded')) {
1962+
$diamond.trigger('destroy.owl.carousel');
1963+
$diamond.removeClass('owl-carousel owl-loaded');
1964+
$diamond.find('.owl-stage-outer').children().unwrap();
1965+
$diamond.find('.owl-stage').children().unwrap();
1966+
}
19561967

19571968
$diamond.addClass('owl-carousel');
19581969

@@ -1969,31 +1980,39 @@ <h3 style="font-size: 22px; color:#fff; margin:0;">
19691980
$diamond.owlCarousel({
19701981
items: 1,
19711982
loop: true,
1972-
margin: 20,
1983+
margin: 24,
1984+
1985+
// ✅ 你要的箭头
19731986
nav: true,
19741987
dots: true,
19751988
navText: [prevSvg, nextSvg],
19761989

1990+
// ✅ 速度别眼花:更慢的切换
19771991
autoplay: true,
1978-
autoplayTimeout: 3500,
1979-
autoplayHoverPause: true, // 桌面 hover 暂停
1980-
smartSpeed: 600,
1992+
autoplayTimeout: 8000, // 原来 3500 太快 → 8000
1993+
smartSpeed: 450, // 动画速度(越小越“干脆”)
1994+
autoplayHoverPause: true,
1995+
1996+
// ✅ 强制任何屏幕都只显示 1 张(防止被 responsive 覆盖)
1997+
responsive: {
1998+
0: { items: 1 },
1999+
600: { items: 1 },
2000+
1024:{ items: 1 }
2001+
},
19812002

1982-
// ✅ Mobile swipe behavior
19832003
touchDrag: true,
1984-
mouseDrag: true,
1985-
pullDrag: true
2004+
mouseDrag: true
19862005
});
19872006

1988-
// ✅ 关键:用户滑动/切换后,把 autoplay 再启动一次(避免“手滑后停住”)
1989-
$diamond.on('dragged.owl.carousel translated.owl.carousel', function(){
1990-
$diamond.trigger('stop.owl.autoplay');
1991-
$diamond.trigger('play.owl.autoplay', [3500]);
2007+
// ✅ 确保 nav 不被主题隐藏
2008+
$diamond.on('initialized.owl.carousel refreshed.owl.carousel', function(){
2009+
$diamond.find('.owl-nav').css({ display:'flex', visibility:'visible', opacity:1 });
19922010
});
19932011
});
19942012
</script>
19952013

19962014

19972015

2016+
19982017
</body>
19992018
</html>

0 commit comments

Comments
 (0)