We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
希望自动滚动的全屏海报加入两个按钮,实现“上一页”,“下一页”的功能
The text was updated successfully, but these errors were encountered:
这个功能我也想了很久,但何苦自己的JS实在...
Sorry, something went wrong.
在main.js 211行左右, 也就是 setInterval 函数结束,
main.js
添加以下代码: 鼠标滑动超过50像素, 左滑下一张, 右划上一张, 为了效果比较好, 把上面定时器的8000即8秒改为15000即15比较好.
// 鼠标按住滑动事件 $('.misty-banner-body').on('mousedown', function(event) { console.log(event); if (event.button === 0) { // 左键按下 let startX = event.clientX; let endX; $(document).on('mousemove', moveHandler); $(document).on('mouseup', upHandler); function moveHandler(event) { endX = event.clientX; } function upHandler(event) { $(document).off('mousemove', moveHandler); $(document).off('mouseup', upHandler); if (endX !== undefined) { console.log("endX , startX",endX , startX); if (endX - startX >= 50) { index -= index == 0 ? -($(".misty-banner-item").length -1) : 1 } else if (endX - startX <= -50) { index += index + 1 == $(".misty-banner-item").length ? -index : 1 } else { return } $(".misty-banner-body").css("left", -(index * 100).toString() + "%") $(".misty-banner-item.active").removeClass("active") let id = $(".misty-banner-item").eq(index).addClass("active").attr("id") $(".misty-banner-logo.active").removeClass("active") $(`.misty-banner-logo[id=${id}]`).addClass("active") } } } });
No branches or pull requests
希望自动滚动的全屏海报加入两个按钮,实现“上一页”,“下一页”的功能
The text was updated successfully, but these errors were encountered: