Using the .load() in IE 7
I have a web page in which I'm trying to create a tool-tip that pops up when you roll over a glossary term. The tool-tip then populates from the external 'glossary.html' page. Works great in IE8 and FF. But IE 7 continues to be the thorn in my side.
On the main web page I use an 'a' tag for the term. This is the one that a tool-tip appears over:
- <a class="gloss" anchor="lorem_ipsum">Lorem ipsum</a>
Then another web pages has a table that holds the glossary. This is a full web page with the html head and body tags still as it needs to be accessible to view the entire glossary if the user clicks on the link.
- <table>
- <tr>
- <td>Term</td>
- <td>Definition</td>
- <td>Primary Lesson</td>
- <tr>
- <tr id="lorem_ipsum">
- <td>lorem ipsum</td>
- <td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit</td>
- <td>demo</td>
- </tr>
- </table>
Lastly I have my jQuery code which creates the tool-tip, positions it, and populates it:
- function simpleTooltip(targetItems, name){
- $(targetItems).each(function(i){
- $("body").append("<div class='"+name+"' id='"+name+i+"'><div class='graphic'></div><h4></h4><hr><p></p></div>");
- var my_tooltip = $("#"+name+i);
- if($(this).attr("anchor") != "" && $(this).attr("anchor") != "undefined"){
- var termName = $(this).attr("anchor");
- $(this).removeAttr("title").mouseover(function(){
- $("#"+name+i+" h4").load("files/PE2011/glossary.html tr#"+termName+" td:nth-child(1)");
- $("#"+name+i+" p").load("files/PE2011/glossary.html tr#"+termName+" td:nth-child(2)");
- my_tooltip.css({opacity:1, display:"none"}).fadeIn(200);
- }).mousemove(function(kmouse){
- var border_top = $(window).scrollTop();
- var border_right = $(window).width();
- var left_pos;
- var top_pos;
- var offset = 24;
- if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){
- left_pos = kmouse.pageX + offset;
- } else{
- left_pos = kmouse.pageX-my_tooltip.width()-offset*2;
- }
- if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){
- top_pos = kmouse.pageY + offset;
- } else{
- top_pos = kmouse.pageY-my_tooltip.height()-offset*2;
- }
- my_tooltip.css({left:left_pos, top:top_pos});
- }).mouseout(function(){
- my_tooltip.fadeOut(200);
- });
- }
- });
- }
With targetItems just being the a.gloss from the main html and the name is just tooltip for CSS purposes.
IE7 just shows up a blank tool-tip. IE8+ and FF work fine.
Thanks in advance for any help!
-Cory