How to replicate href = "... # something" using jquery

It's hard to describe the whole problem, but to make the long story short, I cannot use href = "... # something", but I need this functionality. Is there a way to play it using jquery? So I want to have something like this onclick = "$ ('div # something'). JumpThere ();" but I do not know the exact name of the function. Could you tell me if the jquery function has such a function, and if so, what is it called.

+3
source share
2 answers

You don't need jQuery

window.location.hash = '#something';

must do it.

+6
source

. , .position() , . window.scrollTop ( ). :.position() window.scrollTop

0

Source: https://habr.com/ru/post/1748515/


All Articles