views:

143

answers:

1

Ok, so i took John Raasch's slideshow script and modyfied it too dynamicly fetch images from multiple folders on the server through ajax. The slideshow work like a charm in FF and Chrome but IE is not showing the images. And since IE's javascript debugging possibilities is close to none I cant figure out what is crashing.

Some of the variables and stuff is in Swedish.
Javascript (indenting got messed up when pasting here, but you get the code anyway):

function slideSwitch() {
var $active = $('#box_bildspel IMG.active');

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

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

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

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

//Jquery fetching images from bildspel.php
$(document).ready(function(){
$.get('includes/bildspel.php?page='+page, function(r){
    var file = r.split('!');
    var path = 'pic/bildspel/'+page+'/';
    var data = '';

    if(file != null && file != ''){
        $.each(file, function(key, value){
            if(key == 0) { //If its the first image add the class active
                $('#box_bildspel').append('<img src="'+path+value+'" class="active"></img>');
                //console.log(path+value);
            } else {
                $('#box_bildspel').append('<img src="'+path+value+'"></img>');
                //console.log(path+value);
            }
        });
    }

    //Dont animate if theres just 1 image
    if(file.length > 1){
        $(function() {
            setInterval( "slideSwitch()", 4000 );
        });
    }

});

});

The page variable is declared in the markup of each page on the site.

PHP:

<?php
    function getimgs($page) {

         $path = '../pic/bildspel/'.$page;
         $files = '';

         if ($handle = opendir($path)) {
            while (false !== ($file = readdir($handle))) {
                if ($file !== '.' && $file !== '..') {
                       $files .= $file.'!';
                }
            }
            closedir($handle);

            echo substr_replace($files ,"",-1);;

          }
     }

     getimgs($_GET['page']);
  ?>

Tested in IE 7 & 8

Any ideas? I have a deadline on this site for tomorrow (april 23) would appreciate VERY much if someone could figure this on out for me, thanks in advance!

A: 

Ok, no problem with the code at all. The problem is that the slideshow is beneath a .PNG image with a transparent square. Apparently .PNG transparancy is still not fixed in IE 7&8...

EDIT: That was not the issue at all. My friend who worked on the css had put the z-index to -1.
There was no problem att all with the script, just that the div containing the images was beneath my the wrapper div...

ruuska