XF 1.4 Jump to post

BassMan

Well-known member
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?
 
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.
 
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.
 
Top Bottom