jquery, xml and IE

Soldato
Joined
12 May 2007
Posts
3,896
Location
Bristol
Hopefully someone better with this than I am will be able to help here.

Just pulling variables from an xml sheet and doing some simple animations. All works fine except in IE6 and IE7 where notthing happens. Anyone have any ideas as to what I've done wrong?


Code:
$(document).ready(function(){
    $.ajax({
        type: "GET",
        url: "data.xml",
        dataType: "xml",
        success: function(xml) {
                $(xml).find('data > *').each(function(){
                                        var d = "."+this.nodeName;
                        var top = $(this).find('positiontop').text();
                        var opac = $(this).find('opacity').text();
                        var dur = $(this).find('duration').text();
			var wid = $(this).find('size').text();
			var color = $(this).find('image').text();
 
			$( d +" .bubble").prepend('<img src="media/images/testbubble-' + color + '.png" alt="" class="bubble1" />');
			$( d +" img.bubble1").animate({ "top": top,"opacity": opac, "width": wid, }, dur );
                        $( d +" img.bubble2").animate({ "top": top,"opacity": 0, "width": wid, }, dur );
                });
        }
    });
});

and my xml follows this same pattern for each day of the week.
Code:
<data>
	<mon>
		<positiontop>180</positiontop>
		<opacity>.5</opacity>
		<duration>2500</duration>
		<size>92px</size>
		<image>sun</image>
	</mon>
	<tue>
		<positiontop>120</positiontop>
		<opacity>0.8</opacity>
		<duration>2500</duration>
		<size>25px</size>
		<image>sat</image>
	</tue>
 
Last edited:
I don't know why it's not working, but you could try commenting out individual lines of the code? Would at least help you to track down whether IE doesn't like the XML request, the animation or the prepend.
 
In case anyone cares, which I doubt but sometimes people come across questions when searching for their own answers, I mistakenly added commas after the last elements in my animation. (after "width": wid)
 
Back
Top Bottom