Link to home
Start Free TrialLog in
Avatar of Melody Scott
Melody ScottFlag for United States of America

asked on

Spacing of javascript slide show in FF good, in IE not good

Hi- below is the code I'm using on this page:
s50.funeralhomewebhosting.com/index.php?

The absolute position used on slideshow IMG positions the images correctly on Firefox 12.0, but doesn't move them at all in IE9.  IS there something else I can add that will accomplish the same positioning on IE? Thanks!


<script type="text/javascript" src="/includes/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

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

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

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

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

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

</script>

<style type="text/css">
#slideshow { position:relative; height:390px; }
#slideshow IMG { position:absolute; top:0; left:-15; z-index:8; opacity:0.0; }
#slideshow IMG.active { z-index:10; opacity:1.0; }
#slideshow IMG.last-active { z-index:9; }
</style>

<div id="slideshow">
    <img src="/siteimages/rse/1.jpg" alt="" class="active" />
    <img src="/siteimages/rse/2.jpg" alt="" />
    <img src="/siteimages/rse/3.jpg" alt="" />
</div>

Open in new window

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One other thing of note - when you position an element, make sure you include a measurement (px, em, etc) otherwise it won't work (0 is the exception). You currently have:

left: -15;

It should be

left: -15px;
Avatar of Melody Scott

ASKER

Thanks very much, and DUH!! I knew that about 15px, what is wrong with me?
I'll work on it right now.
Perfect answer!