jquery get window scroll position after clicking on internal link

时间:2018-09-18 20:13:36

标签: javascript jquery

I am trying to get scroll position after I click on anchor (internal click).

$(".nav-link").click(function(){
        console.log($(window).scrollTop());
});

But the value is the one of the position before the scroll is done. How can I get the value when the event is completed?

1 个答案:

答案 0 :(得分:0)

window.onhashchange = function () {
        console.log($(window).scrollTop());
};