我使用的是 javascript marquee,它实际上工作正常,除了:
我正在使用 php 循环(工作完美)来获取在字幕中滚动的内容的每个元素。
内容正确,持续时间也不错,但我的元素彼此相邻,并且我试图在它们之间留出足够的空间。
现在它看起来像element 1element2
,但我正在寻找更多
element 1 element 2
PHP/HTML
<div class="col-lg-12">
<?php foreach($tickerContent as $tContent):?>
<div class="marquee"><h2><?php echo $tContent['content']?></h2>
Javascript:
<script type="text/javascript">
$('.marquee').marquee({
duration: 30000,
gap:40,
});
</script>
最佳答案
根据https://github.com/aamirafridi/jQuery.Marquee处的文档,您必须将重复设置为true
gap Gap in pixels between the tickers. Will work only when the duplicated option is set to true. Default: 20. Note: 20 means 20px so no need to use '20px' as the value.
关于javascript - javascript marquee 中的间距元素,使用 php 循环元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52298080/