I am trying simplify this images rotator function using the next() and end() but I can't figure it out. The goal is to iterate over images, set the title and move to the next image. How can I make this work?
here is my basic html code
<div class="object">
<div class="stories">
<div class="story" title="Microsoft Expression Encoder"
<img src="http://example.com/sample.png" title="" alt=""/>
</div>
<div class="story" title="Microsoft Expression Encoder Repeat" >
<img src="http://example.com/sample.png" title="" alt=""/>
</div>
</div>
<div class="titlebar">
<div class="info"></div>
<div id="btn_next" class="btn_next"></div>
<div id="btn_prev" class="btn_prev"></div>
</div>
</div>
here 开发者_运维百科is the JavaScript code
var rotateImages = function () {
$('.stories div:gt(0)').hide();
$(".info").text($(".story").attr("title"));
$(".stories div:eq(0)")
.animate({ options}, 250,function () {
$(".jqb_info").text($(this).attr(title)).animate({ options }, 500);)
.next('div')animate ({options}, 250, function () {
$(".jqb_info").text($(this).attr(title)).animate({ options }, 500);)
.end().appendTo('.stories');
}
You may be getting an error having those semicolons inside your .text functions.
精彩评论