重新设计"全场景全栈解决方案"板块为幻灯片展示形式
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- 将竖向卡片布局改为上下两层结构 - 上层:7个解决方案标签按钮,支持点击切换 - 下层:幻灯片内容区(左侧文案+右侧图片) - 添加3秒自动播放功能,支持循环切换 - 添加实时进度条显示播放进度 - 鼠标悬停时暂停,离开时恢复播放 - 采用玻璃态毛玻璃背景和科技感渐变配色 - 优化响应式布局,适配桌面、平板和手机端 - 添加流畅的淡入淡出切换动画和光晕效果 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
99
js/index.js
99
js/index.js
@@ -258,4 +258,103 @@ $(function () {
|
||||
$("#cps-box").click(function () {
|
||||
location.href = "partner/cps.html";
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// 全场景全栈解决方案 - 幻灯片功能
|
||||
// ============================================
|
||||
|
||||
(function () {
|
||||
const $tabs = $('.solution-tab');
|
||||
const $slides = $('.solution-slide');
|
||||
const $progressBar = $('.progress-bar');
|
||||
const totalSlides = $slides.length;
|
||||
let currentIndex = 0;
|
||||
let autoPlayTimer = null;
|
||||
let progressTimer = null;
|
||||
const autoPlayDuration = 3000; // 3秒自动切换
|
||||
const progressInterval = 100; // 进度条更新间隔
|
||||
|
||||
// 切换到指定幻灯片
|
||||
function switchSlide(index) {
|
||||
if (index === currentIndex) return;
|
||||
|
||||
// 更新幻灯片
|
||||
$slides.removeClass('active');
|
||||
$slides.eq(index).addClass('active');
|
||||
|
||||
// 更新按钮
|
||||
$tabs.removeClass('active');
|
||||
$tabs.eq(index).addClass('active');
|
||||
|
||||
currentIndex = index;
|
||||
|
||||
// 重置进度条
|
||||
resetProgress();
|
||||
}
|
||||
|
||||
// 切换到下一张
|
||||
function nextSlide() {
|
||||
const nextIndex = (currentIndex + 1) % totalSlides;
|
||||
switchSlide(nextIndex);
|
||||
}
|
||||
|
||||
// 重置进度条
|
||||
function resetProgress() {
|
||||
$progressBar.css('width', '0%');
|
||||
clearInterval(progressTimer);
|
||||
|
||||
let progress = 0;
|
||||
const step = (progressInterval / autoPlayDuration) * 100;
|
||||
|
||||
progressTimer = setInterval(function () {
|
||||
progress += step;
|
||||
if (progress >= 100) {
|
||||
progress = 100;
|
||||
clearInterval(progressTimer);
|
||||
}
|
||||
$progressBar.css('width', progress + '%');
|
||||
}, progressInterval);
|
||||
}
|
||||
|
||||
// 启动自动播放
|
||||
function startAutoPlay() {
|
||||
stopAutoPlay();
|
||||
resetProgress();
|
||||
autoPlayTimer = setInterval(nextSlide, autoPlayDuration);
|
||||
}
|
||||
|
||||
// 停止自动播放
|
||||
function stopAutoPlay() {
|
||||
if (autoPlayTimer) {
|
||||
clearInterval(autoPlayTimer);
|
||||
autoPlayTimer = null;
|
||||
}
|
||||
if (progressTimer) {
|
||||
clearInterval(progressTimer);
|
||||
progressTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮点击事件
|
||||
$tabs.on('click', function () {
|
||||
const index = $(this).data('index');
|
||||
switchSlide(index);
|
||||
startAutoPlay();
|
||||
});
|
||||
|
||||
// 鼠标悬停时暂停自动播放
|
||||
$('.solution-wrapper').on('mouseenter', function () {
|
||||
stopAutoPlay();
|
||||
});
|
||||
|
||||
// 鼠标离开时恢复自动播放
|
||||
$('.solution-wrapper').on('mouseleave', function () {
|
||||
startAutoPlay();
|
||||
});
|
||||
|
||||
// 初始化
|
||||
if (totalSlides > 0) {
|
||||
startAutoPlay();
|
||||
}
|
||||
})();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user