0

The following code is to generate tooltips on hover... hover over some text with the following code e.g.

span class="ttip" rel="#tip_1" 

It then pulls the div in an external file with the id of tip_1.... great... well if you're FF, Opera, Chrome etc..but in IE nothing works!

Any ideas please?

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('.ttip').hover(function(){
            var offset = jQuery(this).offset();
            console.log(offset)

            var width = jQuery(this).outerWidth();
            var tooltipId = jQuery(this).attr("rel");

            jQuery('#tooltip-cont').empty().load('/tooltips.html ' + tooltipId).fadeIn(500);
            jQuery('#tooltip-cont').css({ top:offset.top, left:offset.left + width + 10 }).show();
        }, function(){
            jQuery('#tooltip-cont').stop(true, true).fadeOut(200);
        });
    });
</script>
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
CodeyMonkey
  • 749
  • 4
  • 8
  • 18

1 Answers1

1

Have you tried removing console.log? I have mistakenly left that in my scripts before and without a specialized tool like firebug, it will throw an error. I believe the more widely-supported usage would be:

window.console.log(offset);

Here is a similar question from SO.

Community
  • 1
  • 1
Jage
  • 7,990
  • 3
  • 32
  • 31
  • Thanks, so I simply add that to my jquery ? :) – CodeyMonkey Feb 07 '12 at 11:41
  • You would just actually remove that line or comment it out for the moment. Change console.log(offset) to //console.log(offset) . You may also be getting an error on that line since you have no semi-colon at the end of that line. – Jage Feb 07 '12 at 11:42
  • Hi, - That didn't work :( - It appears to show in the correct place e.g. the tooltip box...but the tooltip content isn't being pulled via aJax... – CodeyMonkey Feb 07 '12 at 11:45
  • But you are farther than you were then in IE? Just want to verify if I was correct that you were receiving an error from that line. Your code snippet here doesn't really tell me for sure what your problem is, but if I had to guess, I would say your url for your load() function looks goofy: '/tooltips.html ' + tooltipId. If toolipId == 't_1' or something like that, your url will be: 'tooltips.html t_1', in which case it's likely you are geting a 404 or something. Either way that is a new problem (and probably a new question). – Jage Feb 07 '12 at 11:51
  • Well, it hasn't got further, it didn't make a difference, is what i'm trying to say... so I would end up posting the question again, hope you can still assist. – CodeyMonkey Feb 07 '12 at 11:54