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

Sticky vote buttons overlapping content #28

Closed
SnoringFrog opened this issue Oct 15, 2015 · 5 comments
Closed

Sticky vote buttons overlapping content #28

SnoringFrog opened this issue Oct 15, 2015 · 5 comments
Labels

Comments

@SnoringFrog
Copy link
Contributor

Not sure when this started happening, but I just noticed this:

sticky_vote_overlaps

Haven't poked around the code myself on this one yet, bit busy for the next several days. I might try and see what I can figure out next week if it's still doing this.

@shu8
Copy link
Owner

shu8 commented Oct 15, 2015

It's something that I used to see at random times, but I thought (hoped) this pull would fix it.

It's something that I cannot seem to reproduce when I want, and happens randomly -- if you do see it again - can you see any pattern? Thanks!

@SnoringFrog
Copy link
Contributor Author

Poker around with this a bit today and managed to get something slightly better, but it feels like a fragile/hacky fix and doesn't fix the comments (but those never overlap with the vote buttons, so while having them move around is weird it doesn't cause readability issues).

Here's the function I've got now:

   stickyVoteButtons: function() { //For making the vote buttons stick to the screen as you scroll through a post   
        //https://github.com/shu8/SE_OptionalFeatures/pull/14:
        $(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"
                     });
                }
            });
        });
    },

And here's how that looks in action:
sticky_vote_overlaps_update01

So not quite a fix, but I thought my progress might help you with one. When the .vote changes to position: fixed then the post/comments slide over. Simultaneously shifting the post/comments to the right works, but I'd think that ideally there would be a way to just make them not shift like they do (maybe the positioning of .vote's container is the issue?).

@mezmi
Copy link
Contributor

mezmi commented Nov 7, 2015

I'm experiencing this as well. No pattern for me, happens on every post.

@shu8
Copy link
Owner

shu8 commented Nov 8, 2015

Yep, I see it as well now -- I am still to find a complete fix - will
hopefully be done in 1.7dev some time... :/

But @SnoringFrog's version is a start! :) Thanks! It seems I forgot to get back to you before...
On Sat, Nov 7, 2015 at 7:56 PM, enkimatt [email protected] wrote:

I'm experiencing this as well. No pattern for me, happens on every post.


Reply to this email directly or view it on GitHub
#28 (comment)
.

@shu8 shu8 added the bug label Nov 8, 2015
@shu8
Copy link
Owner

shu8 commented Feb 5, 2016

@enki-code I'm just going to use @SnoringFrog's version because it works fine, and the comments don't need the buttons, and I haven't been able to figure it out (I have tried!).

Thanks @SnoringFrog for the fix! :)

and sorry for the delay... :/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants