Вот в чем проблема ... У меня есть программа PHP, которая читает и отображает содержимое (4 текстовых поля) базы данных MySQL. Эти записи отображаются последовательно вниз по странице. Я надеюсь прочитать запись и отобразить текст, поставить таймер на паузу, а затем отобразить следующую запись в том же месте на странице. Как слайд-шоу текста.
Если я использую команду CSS position, текст размещается в том же месте, но он просто записывается прямо поверх предыдущей записи. Есть ли способ очистить / удалить контент в определенном месте на странице ... или каким-либо другим способом?






Вам нужны свойства отображения; в частности, display: none и display: block. Начните с первой строки, имеющей display: block, а в остальных - display: none, затем, когда таймер продвинется вперед, переключите первый на display: none и второй на display: block.
Вы, вероятно, захотите справиться с этим исключительно через класс. Задайте для всех строк display: none в CSS, затем по одной строке за раз используйте «активный» класс или что-то подобное, у которого есть 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>
Если текст Ipsum может быть вашими повторенными результатами запроса, и вы можете просто поместить весь этот неупорядоченный список в свой div, вам просто нужно настроить размеры в соответствии с вашими потребностями.
Не могли бы вы опубликовать код, который у вас есть