• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Jump to post

BassMan

Well-known member
#1
When you click on a link to a certain post, at the end of the url you'll see for example like that: #post-7

That post you can see on the top of the page.

How can I lower that position to see a little bit of previous post?
 

AndyB

Well-known member
#5
When you click on a link to a certain post, at the end of the url you'll see for example like that: #post-7

That post you can see on the top of the page.

How can I lower that position to see a little bit of previous post?
Anchors are used which are in the HTML. The browser will always scroll to the anchor, so there's no way to change the scrolling point without moving the anchor point and that's not going to really be possible.
 

BassMan

Well-known member
#8
Anchors are used which are in the HTML. The browser will always scroll to the anchor, so there's no way to change the scrolling point without moving the anchor point and that's not going to really be possible.
I hope it can be done :confused:

Premium style creator such as Audentio, Arty has a workaround for this :)
I think it's via JavaScript.
Thanks for that info.
 

Arty

Well-known member
#9
It requires some JS. Try something like this:
Code:
var $w = $(window);
$w.on('load hashchange', function() {
      var hash = (window.location.hash) ? window.location.hash : '';
       if (!hash) return;
       window.scrollTo($w.scrollLeft(), $w.scrollTop() - 50);
});
In proper code you'd need some additional checks, like checking height of your navigation block and checking if static navigation is even enabled. But that should do.