Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Change where the permalinks to a post lead...?

Hey there,

does anyone know if it's possible to tweak the way the permalinks from a single comment work? And how to do so?

I'd like them to open the page with a scroll position higher than that of the linked post... if that's clear. The top of my forums is obscured by a banner so when you share a link to a post, the post you're meant to look at is partially hidden by the banner.

Cheers :)

Tagged:

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2014

    Try this , add this to your custom.css and give the height of the banner you have. I put 150px as an example.

    body.Vanilla.Discussion.comment  {
    padding-top: 150px;
    }
    
  • This works, but the problem is when you scroll back up the top of the page is, well 150px lower than where it should be... so there's a 150px gap at the top.

  • I can probably use some JS... like, scroll the page down a bit using .scrollTop() ... Gonna try it out.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2014

    if this happens then it is a theme problem with css. It should already detect the top of the page. How did you add the banner ? If it has position:fixed then this will happen

  • Yep, it does have position: fixed, sorry I didn't specify it. (That's why it hides some of the content.)

  • AccentAccent
    edited August 2014

    No, I needed position:fixed :)

    I already had a function that was triggered whenever the window was scrolled, so I used this:

    if (firstScroll && $('body').hasClass("Vanilla Discussion comment")){
        currentScroll = $(this).scrollTop() - 250;
        $(this).scrollTop(currentScroll);
    
        firstScroll = false;
    }
    

    I also use that opportunity to style the linked comment... works like a charm. Thanks for helping me find that! :)

Sign In or Register to comment.