views:

267

answers:

1

Hi all - I am working on a jQuery script on http://www.qxl.dk/ and I can't seem to get IE7 (or more accurately, IE8 in IE7 compatibility mode) to load my content.

The sidebar box on the right named "QXL Aktuelt" loads its HTML content from an external file using Ajax load(), then triggers a custom jQuery event ("aktuelt_loaded") that starts a carousel script (like a scrolling newsticker).

Several other content sections on the same page are loaded through Ajax and they work just fine, so I'm wondering what's going wrong. Everything works as expected in Firefox 3.6 and IE8, but not in IE8's compatibility mode.

The script that loads the Ajax content is (inline on the page):

<div id="qxlaktueltHolder"></div>
<script type="text/javascript">
    $("#qxlaktueltHolder").load("/contents/dk/modul/qxlaktuelt/qxlaktuelt.htm", function() {
        $("#qxlaktueltHolder").trigger("qxlaktuelt_loaded", []);
    });
</script>
<script type='text/javascript' src='http://www.qxl.dk/contents/dk/js/jcarousellite_1.0.1.min.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='http://www.qxl.dk/contents/dk/js/qxlaktuelt_liveload.js'&gt;&lt;/script&gt;

The external script that responds to the event is in the following file:

http://www.qxl.dk/contents/dk/js/qxlaktuelt_liveload.js

All ideas are very welcome.

+3  A: 

EDIT:

Looks like your content is being loaded. You seem to have a CSS display issue. Using IE's developer tools, I searched for the href of an a that was loaded properly in Safari

http://www.123hjemmeside.dk/pages/receive.aspx?target=wl&amp;partnerkey=dkqxl:Hobby_aktuelt_1

and found that is was on the page along with all the other content.

UPDATE:

The problem is with your #newsticker element. It, and all of its li elements, have height and/or width properties set to 0.

So whatever code is responsible for sizing/displaying the #newsticker and its content seems to be the culpret.


This is a guess, but this script qxlaktuelt_liveload.js is being loaded after this:

<script type="text/javascript">
    $("#qxlaktueltHolder").load("/contents/dk/modul/qxlaktuelt/qxlaktuelt.htm", function() {
        $("#qxlaktueltHolder").trigger("qxlaktuelt_loaded", []);
    });
</script>

So depending on how long the load() takes, the script may or may not be loaded.

Try:

<script type='text/javascript' src='http://www.qxl.dk/contents/dk/js/jcarousellite_1.0.1.min.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='http://www.qxl.dk/contents/dk/js/qxlaktuelt_liveload.js'&gt;&lt;/script&gt;
<script type="text/javascript">
    $("#qxlaktueltHolder").load("/contents/dk/modul/qxlaktuelt/qxlaktuelt.htm", function() {
        $("#qxlaktueltHolder").trigger("qxlaktuelt_loaded", []);
    });
</script>
patrick dw
Actually, that shouldn't be a problem - at least it isn't in IE8 or Firefox (I've tested using delays etc. and the event model I use works regardless of what is loaded first, the script or the Ajax content).But on the other hand, compatibility mode tends to make up its own rules as it goes along, so I'll give it a try. Thanks for the reply
Jens Roland
Didn't work.. :(
Jens Roland
@Jens Roland - Yeah, `load()` being asynchronous, I sort of figured that `qxlaktuelt_liveload.js` might have a chance to load before the response came back. Although, if the response was fast enough, there would be an issue, so it is better practice to load your script files in proper order, so that you're not referencing code in a file that hasn't loaded yet.
patrick dw
@Jens Roland - Looks to me like your content is being loaded. It appears to be a CSS display issue. I copied the `href` of an element that was loaded in Safari, and did a search for it in the developer tools in IE. Sure enough, it was there, along with all the others. I'll update my answer to reflect the fact, and will try to see if I can find a quick resolution to the CSS issue.
patrick dw
Interesting!!!! Thanks a bunch - that narrows it down a lot! The code that displays the LI items is in the jCarousel file, and I'll try delaying that until window.load - that could be it :)
Jens Roland
Glad I could help. :)
patrick dw
Window.load worked - yay! Thanks for the help, I am marking your answer as correct. Well done!!
Jens Roland