我希望每个<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()
来暂停和启动marquee
。
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字幕滑块。因为它将与跨浏览器兼容。
不建议使用none标准html标记,因为它的实现方式会有所不同,并且可能无法在其他浏览器中实现从mozilla开发者那里阅读https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee
为了更好地使用jquery marquee插件,在谷歌上搜索它,你会发现很多插件只需选择你认为最适合你的插件,然后使用并停止使用marquee标签
如果我理解你想要什么,只需添加以下CSS,这样每个li
都将单独显示,并且由于marquee
的高度限制,它们之间会有一点延迟:
p {
height: 250px;
}
<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 [1]
</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 [2]
</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 [3]
</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 [4]
</p></li><br/>
</ul>
</marquee>
</div>
如果桌面是您唯一支持的平台,那么您可以放心地使用marque。Marque有两个js处理程序stop
和start
,您可以使用它们来控制它。