Created
December 11, 2009 18:17
-
-
Save garyharan/254392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('p[time]').live('mouseover', function() { | |
var insertion = $(this); | |
var insertionTime = insertion.attr('time'); | |
var timeSpan = insertion.find('span.time'); | |
if (timeSpan.length) { | |
timeSpan.show(); | |
} else { | |
var date = new Date(); | |
date.setTime(insertionTime * 1000); | |
// determine how you want to format your time stamp here | |
$('<span/>') | |
.addClass('time') | |
.css({ | |
'float': 'right', | |
'background-color': '#FFF', | |
'padding': '1px 5px 1px 5px', | |
'font-size': '0.8em', | |
'-moz-border-radius': '3px', | |
'-webkit-border-radius': '3px', | |
'border-radius': '3px' | |
}) | |
.html(date.toString()) | |
.appendTo(insertion); | |
} | |
}).live('mouseout', function(){ | |
$(this).find('span.time').hide(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment