I´m using an different box for title atrib in elements. I´ve developed a simple jQuery stuff to do it but... the "best friend ever", IE, don´t work correctly. It´s simple don´t remove the title atrib as the other browsers do. The result: i´ve the box showing the title atrib and the own browser box over this. How can i resolve this? (code next). NOTE: works on Chrome, Safari, Firefox, Opera. But IE don´t.
<title>Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
#dbox {
background: #003767;
padding: 5px 8px;
position: absolute;
margin: 20px;
color: white;
font-size: 14px;
display: inline;
/* border radius specif browsers */
-webkit-border-radius: 3px; /* safari, chrome */
-khtml-border-radius: 3px; /* ktml browsers */
-moz-border-radius: 3px; /* firefox, mozila found. */
-o-border-radius: 3px; /* opera, opmob */
}
</style>
<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
<script type="text/javascript">
var dbox_time = 120;
var delay_time = 500;
$(document).ready(function(){
$('<div id="dbox"></div>').insertAfter(('body'));
$("[title != '']").each(function() {
$(this).addClass('lkBox');
$(this).css({border: '1px solid red'});
});
$('#dbox').empty();
$('#dbox').css({
display: 'none',
opacity: '0'
})
$(document).mousemove(function(e){
$('#dbox').css({
'left': e.pageX,
'top' : e.pageY
})
})
$('.lkBox').mouseover(function(){
$('#dbox').text($(this).attr('title'));
$('#dbox').css({display: 'block'})
.stop().animate({opacity: '1'}, dbox_time)
})
$('.lkBox').mouseout(function(){
$(this).attr('title', $('#dbox').text());
$('#dbox').css({display: 'none'})
.stop().animate({
opacity: '0'
}, dbox_time)
})
})
</script>
Body:
<div style="float: left; width: 70%; padding: 50px;">
<h1>Examples: (mouse over the links)</h1>
<p>Curabitur lacus tortor, pellentesque eget <a href="#">interdum in</a>, auctor et lorem. In in quam lorem, vel <a href="#" title="i´m am a title =). must show">sagittis lec</a>. Donec felis leo, id fermentum nibh porttitor. Vestibulum ante <a href="#" title="">empy title (dont need to work)<span></span></a> primis. Lorem ipsum dolor sit amet, <a href="#" title="another title to show">lorem ipsum</a> elit.</p>
</div>
INFO: if an alert is placed after
$(this).attr('title', $('#dbox').text());
it work on IE.. but i can´t use an alert.