javascript - 如何暂时停止字幕文本然后继续?

标签 javascript jquery html marquee

我想当每个<li>结束字幕停止几秒钟,然后继续下一个 <li> .这是我的代码:

<div id="teks_container" >
    <marquee direction="up" scrollamount="3"  height="200px">
	<ul>
	   <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	    </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
       </ul>
    </marquee>
</div>

最佳答案

您可以使用this.start()this.stop() 来暂停和启动跑马灯

var start = true;
setInterval(passStartMarquee, 1500 );
// adjust the delay

function passStartMarquee() {
    if (start) {
      document.querySelector('marquee').start();
      start = false;
     } else {
       document.querySelector('marquee').stop();
       start = true;
     }     
}
<div id="teks_container" >
    <marquee direction="up" scrollamount="3"  height="200px">
	<ul>
	   <li ><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	    </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
           <li><strong><p align="justify">
	        I was wondering if it's possible</strong> to create HTML Rolling Credits in a website. If so, how do I need to do? Thanks
	   </p></li><br/>
       </ul>
    </marquee>
</div>

我宁愿使用 jquery 选取框 slider 。因为它将跨浏览器兼容。

关于javascript - 如何暂时停止字幕文本然后继续?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29405091/

相关文章:

javascript - 当我尝试格式化日期时 Chart.js 没有显示

c# - javascript切换背景图片

javascript - 飞气球动画

javascript - 悬停时更改背景图像并保持事件状态

html - 如何在 CSS 中同时垂直和水平对齐?

javascript - PhoneGap 3.0 iOS 插件

jquery - 如何在没有 JS 的情况下使 instagram iframe 响应?

javascript - 数据表日期排序 dd-mm-yyyy 问题

javascript - 从隐藏元素获取宽度大小

php - 你如何缩进你的HTML?