Topic: JQuery rotate image banner if more div tags

Hi,

I am using image banner for rotation using jQuery .
This is working when used for only images but failes when included more HTML div tag in it .

working code :
function slideSwitch() {
    var $active = jQuery('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = jQuery('#slideshow DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : jQuery('#slideshow DIV:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

HTML :
<div id="slideshow">
<div class="active">
image_tag("ban1.jpg",:width=>"388",:height=>"301",:alt=>"banne1")
</div>
<div>
image_tag("ban2.jpg",:width=>"388",:height=>"301",:alt=>"banne2")
</div>
<div>
image_tag("ban3.jpg",:width=>"388",:height=>"301",:alt=>"banne3")
</div>

Actual code is like this :
<div id="slideshow">
<div class="active">
                      <div class="top_banner">
                        <div class="banner_left_text" style="font-family:'Trebuchet MS',Arial;">
                          <div class="banner_toptext"> Welcome </div>
                        </div>
                        <div class="banner_right_image"> <%= image_tag("ban1.jpg",:width=>"388",:height=>"301",:alt=>"banne1")%></div>
                      </div>
                    </div>
<div>.....2nd image </div>
<div>.....3rd image </div>
</div>

How to rotate banner if it contains more html div tags ?
Can any one help me with modified JQuery code on this .

thanks in advance.

Last edited by srinathbtech (2010-11-11 14:55:36)