0

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');
}
guyndjeng
  • 1
  • 1

1 Answers1

2

You may be getting an error having those semicolons inside your .text functions.

wajiw
  • 12,239
  • 17
  • 54
  • 73
  • jQuery(document).ready(function () { $('.jqb_stories div:gt(0)').hide(); $(".jqb_info").text($(".jqb_story").attr("title")); $(".jqb_stories div:eq(0)").animate({ opacity: 'hide', "left": "-50px" }, 250, function () { $(".jqb_info").text($(this).attr('title')).animate({ opacity: 'hide', "left": "-50px" }, 500); }).next('div').animate({ opacity: 'hide', "left": "-50px" }, 250, function () { $(".jqb_info").text($(this).attr('title')).animate({ opacity: 'hide', "left": "-50px" }, 500); }).end().appendTo('.stories'); }); the image – guyndjeng Nov 17 '10 at 18:59
  • Can you update your question with that code? Comments are hard to look at because they don't format the code at all. – wajiw Nov 17 '10 at 19:00
  • I posted another question, I was having a hard time with formatting my code. the question is still tagged in JQuery traversing.. check it ouy!!! – guyndjeng Nov 17 '10 at 19:12