jQuery: jump to next

前端 未结 5 1029
無奈伤痛
無奈伤痛 2021-01-24 00:34

So this should be fairly basic... and I\'m doing it, but I wanted to ask for a few different options.

One option is using the \"Smooth Scroll\" and anchor names... but I

5条回答
  •  春和景丽
    2021-01-24 01:22

    You could try just setting the scrolltop

    var doc = (document.contentWindow || document).document || document.ownerDocument || document,
        el = ($.browser.webkit) ? doc.body : doc.documentElement;
    
    $(el).scrollTop($('#services').offset().top);
    

提交回复
热议问题