clip to top

This commit is contained in:
Michael Save 2012-03-16 09:48:37 +11:00
parent 1d7381554d
commit 34fc25f716

View File

@ -32,19 +32,19 @@ $(document).ready(function(){
.attr('id', 'post-hover-' + id) .attr('id', 'post-hover-' + id)
.addClass('post-hover') .addClass('post-hover')
.css('position', 'absolute') .css('position', 'absolute')
.css('left', e.pageX + 15)
.css('top', e.pageY - post.height() - 15)
.css('border-style', 'solid') .css('border-style', 'solid')
.css('box-shadow', '1px 1px 1px #999') .css('box-shadow', '1px 1px 1px #999')
.insertAfter($(this).parent()); .insertAfter($(this).parent());
$(this).trigger('mousemove');
} }
}, function() { }, function() {
post.attr('style', ''); post.attr('style', '');
$('.post-hover').remove(); $('.post-hover').remove();
}).mousemove(function(e) { }).mousemove(function(e) {
var top = e.pageY - post.height() - 15;
$('#post-hover-' + id) $('#post-hover-' + id)
.css('left', e.pageX + 15) .css('left', $(this).width() + e.pageX)
.css('top', e.pageY - post.height() - 15); .css('top', top > $(window).scrollTop() ? top : $(window).scrollTop());
}); });
}); });
}); });