Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何以设定的间隔单独显示行?_Php_Javascript_Css - Fatal编程技术网

Php 如何以设定的间隔单独显示行?

Php 如何以设定的间隔单独显示行?,php,javascript,css,Php,Javascript,Css,问题是。。。。我有一个PHP程序读取和显示MySQL数据库的内容(4个文本字段)。这些记录按顺序显示在页面下方。我希望做的是读取一条记录并显示文本,用一个小计时器暂停,然后在页面上的相同位置显示下一条记录。就像文本的幻灯片 如果我使用CSS position命令,文本将被定位在相同的位置,但它只是写在上一条记录的正上方。是否有办法清除/删除页面上特定位置的内容。。。。或者其他方法来实现这一点?您需要显示属性;具体来说,display:none和display:block。从第一行显示:block

问题是。。。。我有一个PHP程序读取和显示MySQL数据库的内容(4个文本字段)。这些记录按顺序显示在页面下方。我希望做的是读取一条记录并显示文本,用一个小计时器暂停,然后在页面上的相同位置显示下一条记录。就像文本的幻灯片


如果我使用CSS position命令,文本将被定位在相同的位置,但它只是写在上一条记录的正上方。是否有办法清除/删除页面上特定位置的内容。。。。或者其他方法来实现这一点?

您需要显示属性;具体来说,display:none和display:block。从第一行显示:block开始,其余行显示:none,然后当计时器前进时,将第一行切换为display:none,将第二行切换为display:block


您可能希望纯粹通过类来处理这个问题。在CSS中将所有行设置为display:none,然后一次使用一个“active”类或类似的具有display:block的类。

如果您使用像jQuery这样的库来做JavaScript脏活,那么我建议您做一些类似的事情

<style type="text/css">
    ul {
        margin:0;
        padding:0;
        list-style:none;
        width:300px;
        height:300px;
        overflow:hidden;
        border:#000 1px solid;
    }
    ul li{
        margin:0;
        padding:0;
        list-style:none;
        width:300px;
        height:300px;
        display:none;
    }
    .active{
        display:block;
    }
</style>

<ul>
   <li class="active">1 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </li>
   <li>2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </li>
   <li>3 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </li>
   <li>4 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </li>
</ul>​​​​​​​​​​​​​

<script type="text/javascript">
​setInterval(function()
{
   if($('ul li[class="active"]').is(':last-child'))
   {
       $('ul li[class="active"]').removeClass('active');
       $('ul li:first').addClass('active')
   }   
   else
   {
       $('ul li[class="active"]').removeClass('active').next().addClass('active');
   }
},5000);
​</script>

保险商实验室{
保证金:0;
填充:0;
列表样式:无;
宽度:300px;
高度:300px;
溢出:隐藏;
边框:#000 1px实心;
}
ulli{
保证金:0;
填充:0;
列表样式:无;
宽度:300px;
高度:300px;
显示:无;
}
.主动{
显示:块;
}
  • 1 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布,包括Lorem Ipsum版本
  • Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布,包括Lorem Ipsum版本
  • 3 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布,包括Lorem Ipsum版本
  • 4 Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书。它不仅存活了五个世纪,而且还跨越到电子排版,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset表单的发布而流行,最近随着Aldus PageMaker等桌面出版软件的发布,包括Lorem Ipsum版本
​​​​​​​​​​​​​ ​setInterval(函数() { if($('ul li[class=“active”]”)是(':last child')) { $('ul li[class=“active”]')。removeClass('active'); $('ul li:first').addClass('active')) } 其他的 { $('ul li[class=“active”]).removeClass('active').next().addClass('active'); } },5000); ​
如果Ipsum文本可以作为查询的回传结果,并且您可以将整个无序列表放入div中,那么您只需要相应地调整大小以满足您的需要


你能把你目前掌握的代码公布出来吗