-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stickyVoteButtons shows glitches at top and bottom #235
Comments
Thanks for reminding me. I've known about this for a while just never got around to fixing it. We will add it to the list of things to get done. |
@wgrundlingh the shift to the right's been fixed in dev 2.0.16 :) but the on off glitch is still there (for now!) |
Completely ignore the solution I posted before. Here's something better:
This should fix a lot more bugs. The problem was that the height of EDIT: Fixed bugs when editing inline |
Thanks, I'll get this added in ASAP! :)
…On 9 Feb 2017 02:08, "IStoleThePies" ***@***.***> wrote:
Completely ignore the solution above, I wrote something better:
stickyVoteButtons: function() {
// Description: For making the vote buttons stick to the screen as you scroll through a post
//shu8/Stack-Overflow-Optional-Features#14:
//shu8/Stack-Overflow-Optional-Features#28: Thanks @SnoringFrog for fixing this!
stickcells();
$(document).on('sox-new-review-post-appeared', stickcells);
$(window).scroll(function() {
stickcells();
});
function stickcells() {
var $votecells = $('.votecell');
$votecells.css('width', '46px');
$votecells.each(function() {
var $topbar = $('.topbar'),
topbarHeight = $topbar.outerHeight(),
offset = (sox.location.on('/review') ? 60 : 10);
if ($topbar.css('position') == 'fixed') offset += topbarHeight;
var $voteCell = $(this),
$vote = $voteCell.find('.vote'),
vcOfset = $voteCell.offset(),
scrollTop = $(window).scrollTop();
if ($vote.children().last().length && $vote.length && $voteCell.next().find('.fw').length) { //These values strangely alternate between existing and not existing. This if statement insures we only get their values when they exist, so no errors.
var realHeight = $vote.children(':not(:hidden, .message-dismissable)').last().offset().top + $vote.children(':not(:hidden, .message-dismissable)').last().height() - $vote.offset().top; //Get the original height; the difference between the last child and the first child's position
var votePos = $vote.offset().top,
fwPos = $voteCell.next().find('.fw').offset().top + 17; //I think a bit below .fw (where the "edit", "delete", etc. buttons lie) is a good place to stop the stickiness.
}
if (realHeight + vcOfset.top < fwPos && vcOfset.top - scrollTop - offset <= 0) { //Left condition is for scrolling down into the sticky zone from outside. Right condition is to get rid of a sticky zone on extremely short posts
if (fwPos - realHeight > votePos || fwPos - scrollTop - realHeight - offset >= 0) { //Left condition marks the bottom limit for the sticky zone. Right condition is for scrolling up into the sticky zone from outisde.
$vote.css({
position: 'fixed',
top: offset
});
} else {
//Stop stickiness when we've scrolled down past the sticky zone.
$vote.css({
position: 'absolute',
top: fwPos - realHeight //Leave the button at its bottommost position
});
}
} else {
$vote.removeAttr('style');
}
});
}
},
This should work a lot better.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#235 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIcNjth1o5AoxLNqxts_m4pBOs3V2KtLks5ranUYgaJpZM4Lk8P8>
.
|
@calebkleveter I can't repro that... how/when does that bug happen? |
@Sir-Cumference thanks sooooo much! I've added it into dev 2.0.22 :) @wgrundlingh it's fixed! :) |
To do this I am using smart zoom on an Apple Magic Mouse. Go to any answer that is long enough to enable sticky vote buttons. Then smart zoom at the middle of the answer. |
Ok thanks, I'll look into it when I get a bit more time :)
…On 13 Feb 2017 22:20, "Caleb Kleveter" ***@***.***> wrote:
To do this I am using smart zoom on an Apple Magic Mouse.
Go to any answer that is long enough to enable sticky vote buttons. Then
smart zoom at the middle of the answer.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#235 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIcNjq0AilGTwEZnZo4ubaNYSt9hXmmSks5rcNc8gaJpZM4Lk8P8>
.
|
Installed Version: 2.0.15 Environment: Tampermonkey
Current Behaviour
The stickyVoteButtons feature shows a minor displacement when scrolling from the top of a post, with an on-off glitch at the bottom of the post:
SOX Errors logged to the browser console -- F12 (if available)
Steps to reproduce
Features Enabled
The text was updated successfully, but these errors were encountered: