Browse Source

Don't show post when it's already in view. Highlight it instead.

pull/40/head
Michael Save 12 years ago
parent
commit
1d7381554d
  1. 27
      js/post-hover.js

27
js/post-hover.js

@ -20,17 +20,26 @@ $(document).ready(function(){
} }
var post = $('div.post#reply_' + id); var post = $('div.post#reply_' + id);
if(post.length == 0)
return;
$(this).hover(function(e) { $(this).hover(function(e) {
post.clone() if($(window).scrollTop() <= post.offset().top + post.height()) {
.attr('id', 'post-hover-' + id) // post is in view
.addClass('post-hover') post.attr('style', 'border-style: none dashed dashed none; background: ' + post.css('border-right-color'));
.css('position', 'absolute') } else {
.css('left', e.pageX + 15) post.clone()
.css('top', e.pageY - post.height() - 15) .attr('id', 'post-hover-' + id)
.css('border-style', 'solid') .addClass('post-hover')
.css('box-shadow', '1px 1px 1px #999') .css('position', 'absolute')
.insertAfter($(this).parent()); .css('left', e.pageX + 15)
.css('top', e.pageY - post.height() - 15)
.css('border-style', 'solid')
.css('box-shadow', '1px 1px 1px #999')
.insertAfter($(this).parent());
}
}, function() { }, function() {
post.attr('style', '');
$('.post-hover').remove(); $('.post-hover').remove();
}).mousemove(function(e) { }).mousemove(function(e) {
$('#post-hover-' + id) $('#post-hover-' + id)

Loading…
Cancel
Save