javascript - 在轮播上添加暂停/播放功能

标签 javascript jquery html css

如何在此轮播上添加播放和暂停功能请帮助我.. 代码在链接下方:

http://jsfiddle.net/P5295/

<div id="carousel">
    <figure>1</figure>
    <figure>2</figure>
    <figure>3</figure>
    <figure>4</figure>
    <figure>5</figure>
    <figure>6</figure>
    <figure>7</figure>
    <figure>8</figure>
    <figure>9</figure>
</div>

最佳答案

添加以下 CSS 以在悬停时暂停。 Here is the demo .

#carousel:hover {
    -webkit-animation-play-state : paused;
    -moz-animation-play-state : paused;
    -o-animation-play-state : paused;
    animation-play-state : paused;
}

Try this example如果您想使用按钮暂停。在这种情况下,唯一的问题是按钮必须在轮播旁边。

如果您希望您的按钮位于旋转木马旁边的其他任何地方,那么您必须使用 JS/jQuery like this .

如果你想暂停和恢复使用按钮点击,try this example

如果你想要 2 个停止和启动按钮,try this one

关于javascript - 在轮播上添加暂停/播放功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23078973/

相关文章:

javascript - 如何将多个属性键作为参数传递给使用括号表示法的函数?

javascript - 点击特定选项卡即可获取对应的详细信息

html - 使用 Flexbox 使无序列表响应

上传到 URL 时 JavaScript 不工作

javascript - 如何将 base64 转换为 html 文件?

javascript - 如何有效地将游戏数据存储在 URL 查询字符串中?

javascript - JQuery 和 Bootstrap 4 Popover 冲突?

javascript - JQuery 粘条在页面调整大小时闪烁

jquery - 使用悬停上方显示的编辑图标编辑表格数据单元格

html - 在导航栏标题中调整 Logo 大小