I used a code that was mentioned here several times, starting with:
$('a[href*="#"]').off('touchstart click');
var $body = $('body');
var bodyHeight = $body.outerHeight();
var adminbarHeight = $('#wpadminbar').outerHeight();
var navbarFixedTopHeight = $('.x-navbar').outerHeight() - 32;
var locHref = location.href;
var locHashIndex = locHref.indexOf('#');
var locHash = locHref.substr(locHashIndex);
It works as it should on desktop and mobile as well, but on mobile devices (I tested with iPhone and iPad) the page stops for a moment the wanted section and then scrolls a bit further ignoring the offset, so the sticky navigation covers parts of the content. Is there a solution? 
Best regards.