mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 07:30:10 +01:00
Check if post is below viewable region.
This commit is contained in:
parent
ce25db62ea
commit
a2ac54e01e
@ -21,9 +21,15 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var post = false;
|
var post = false;
|
||||||
|
var hovering = false;
|
||||||
$(this).hover(function(e) {
|
$(this).hover(function(e) {
|
||||||
|
hovering = true;
|
||||||
|
|
||||||
var start_hover = function(link) {
|
var start_hover = function(link) {
|
||||||
if(post.is(':visible') && $(window).scrollTop() <= post.offset().top + post.height()) {
|
if(post.is(':visible') &&
|
||||||
|
post.offset().top + post.height() >= $(window).scrollTop() &&
|
||||||
|
post.offset().top <= $(window).scrollTop() + $(window).height()
|
||||||
|
) {
|
||||||
// post is in view
|
// post is in view
|
||||||
post.attr('style', 'border-style: none dashed dashed none; background: ' + post.css('border-right-color'));
|
post.attr('style', 'border-style: none dashed dashed none; background: ' + post.css('border-right-color'));
|
||||||
} else {
|
} else {
|
||||||
@ -44,6 +50,7 @@ $(document).ready(function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
post = $('div.post#reply_' + id);
|
post = $('div.post#reply_' + id);
|
||||||
|
console.log(post);
|
||||||
if(post.length > 0) {
|
if(post.length > 0) {
|
||||||
start_hover(this);
|
start_hover(this);
|
||||||
} else {
|
} else {
|
||||||
@ -63,13 +70,16 @@ $(document).ready(function(){
|
|||||||
.find('div.post#reply_' + id);
|
.find('div.post#reply_' + id);
|
||||||
if(typeof window.enable_fa == 'function' && localStorage['forcedanon'])
|
if(typeof window.enable_fa == 'function' && localStorage['forcedanon'])
|
||||||
enable_fa();
|
enable_fa();
|
||||||
start_hover(link);
|
if(hovering)
|
||||||
|
start_hover(link);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
|
hovering = false;
|
||||||
if(!post)
|
if(!post)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
post.attr('style', '');
|
post.attr('style', '');
|
||||||
if(post.hasClass('hidden'))
|
if(post.hasClass('hidden'))
|
||||||
post.css('display', 'none');
|
post.css('display', 'none');
|
||||||
|
Loading…
Reference in New Issue
Block a user