Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
#28 fixed
Browse files Browse the repository at this point in the history
fixes #28
  • Loading branch information
shu8 committed Feb 5, 2016
1 parent c901545 commit c477b73
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions features.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ var functionsToCall = { //ALL the functions must go in here

$('.comments textarea').on('keydown', null, 'alt+o', function() {
$('#quickCommentShortcuts').show();
$("body").animate({
scrollTop: 0
$("body").animate({
scrollTop: 0
}, "slow");
});
$('.comments textarea').bind('keydown', 'alt+r', function() {
Expand Down Expand Up @@ -947,34 +947,48 @@ var functionsToCall = { //ALL the functions must go in here
},

stickyVoteButtons: function() { //For making the vote buttons stick to the screen as you scroll through a post
//https://github.com/shu8/Stack-Overflow-Optional-Features/pull/14:
//https://github.com/shu8/SE_OptionalFeatures/pull/14:
//https://github.com/shu8/Stack-Overflow-Optional-Features/issues/28: Thanks @SnoringFrog for fixing this!
$(window).scroll(function() {
$(".votecell").each(function() {
var offset = 0;
if ($(".topbar").css("position") == "fixed") {
offset = 34;
}
var vote = $(this).find(".vote");
var post_contents = $(this).next("td.postcell, td.answercell");
if ($(this).offset().top - $(window).scrollTop() + offset <= 0) {
if ($(this).offset().top + $(this).height() + offset - $(window).scrollTop() - vote.height() > 0) {
vote.css({
position: "fixed",
left: $(this).offset().left,
top: 0 + offset
});
post_contents.css({
position: "relative",
left: "45px"
});
} else {
vote.css({
position: "relative",
left: 0,
top: $(this).height() - vote.height()
});
post_contents.css({
position: "relative",
left: "0px"
});
}
} else {
vote.css({
position: "relative",
left: 0,
top: 0
});
post_contents.css({
position: "relative",
left: "0px"
});
}
});
});
Expand Down

0 comments on commit c477b73

Please sign in to comment.