jQueryスライドショーを作成したので、テキストと画像は想定どおりに循環しますが、繰り返されません。画像やテキストだけを循環させると、繰り返されますが、一緒にはなりません。
HTML:
<div id="slideshow">
<div id="slideContain">
<img src="http://www.codekrewe.com/images/surf.png" height="200px" width="300px" />
<img src="http://www.codekrewe.com/images/leafriverresources.png" height="200px" width="300px" />
<img src="http://www.codekrewe.com/images/bookReviews.png" height="200px" width="300px" />
<p class="slideInfo">Surf Shack Yogurt was a fun business to work with. They gave me a shot when I had barely anything to prove my worth, and for that, I thank them. This website help me expand my knowledge about web development/design...</p>
<p class="slideInfo">I found Leaf River Resource's website to have a unique challenge when developing/designing it. The oil/gas business does not want to disclose all of their info/tricks on a website for all of their competitors to see...</p>
<p class="slideInfo">This book database site was requested by an english teacher at Castle View High School for his students. This website gave me much needed practice and new knowledge that I can now apply to future projects...</p>
</div>
</div>
CSS:
#slideContain{
position:relative;
width:900px;
height:250px;
margin-left:auto;
margin-right:auto;
}
#slideContain img{
position:absolute;
left:5px;
top:25px;
}
#slideContain p{
width:570px;
height:200px;
position:absolute;
left: 330px;
top:25px;
}
.slideInfo{
color:#333;
text-shadow:0px -1px 1px #CCC;
}
JavaScript:
$(function() {
$('#slideContain img:gt(0)').hide();
$('#slideContain p:gt(0)').hide();
setInterval(function() {
$('#slideContain img:first').fadeOut(1000)
.next('img').fadeIn(1000)
.end().appendTo('#slideContain');
}, 3000);
setInterval(function() {
$('#slideContain .slideInfo:first').fadeOut(1000)
.next('.slideInfo').fadeIn(1000)
.end().appendTo('#slideContain');
}, 3000);
});
</ p>