在修复我的这个小推荐箱时,我将不胜感激。现在,我不知道问题出在 PHP、CSS 还是我的标记上,因为虽然帖子似乎褪色了,但它们都同时出现,第一个褪色只是继续显示第三个帖子。
这是脚本:
<script language="javascript">
jQuery(document).ready(function(){
jQuery('#testimonials .slide');
setInterval(function(){
jQuery('#testimonials .slide').filter(':visible').fadeOut(1000,function(){
if(jQuery(this).next('.slide').size()){
jQuery(this).next().fadeIn(1000);
}
else{
jQuery('#testimonials .slide').eq(0).fadeIn(1000);
}
});
},1500);
});
</script>
PHP/HTML:
<?php
$loop = new WP_Query(array('post_type' => 'qcamp', 'posts_per_page' => 5));
if ($loop->have_posts()) { ?>
<div id="camps-quote">
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div id="testimonials">
<div class="slide">
<div class="testimonial-quote">
<?php the_content(); ?>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<?php } ?>
最后是 CSS:
#camps-quote {
margin-top:50px;
box-shadow: 7px 7px 7px #C0C0C0;
background-color: #7D9EC0;
height: 120px;
font-size: 16px;
padding:7px;
font-family: Arial;
width:500px;
margin-left:200px;
overflow:hidden;
}
#testimonials{
}
#testimonials .slide {color: #fff;}
#testimonials .testimonial-quote {
padding: 3px 0 0 65px;
line-height: 1.5em;
font-family:Helvetica, Arial, sans-serif !important;
font-size: 16px;
font-weight: normal;
font-style: italic;
margin: 10px 0 20px 0;
}