0

私の JavaScript コードでは、div までスクロールできますが、その div よりも 20 ピクセル高くするには JavaScript が必要です。私のコードはこれです

$(function() {
    $('a[href*=#]:not([href=#])').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
          var target = $(this.hash);
          target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
              if (target.length) {
                $('html,body').animate({
                  scrollTop: target.offset().top
                }, 1000);
                return false;
              }
        }
    });
});

誰かがそれ10pxよりも高くなるようにすることができますかdiv? どうもありがとうございました

http://www.sventasticable.nlに関するより具体的な問題を知りたい場合は、これが私の Web ページです。

私の英語はあまり上手ではありません。

4

1 に答える 1