728x90
SMALL
You need the ability to move to the desired position by pressing a specific button while developing the Web.
The logic is not difficult.
After receiving the position value of the corresponding area, the scroll may be moved to that position.
Below is the code.
<script>
//It receives the position value with the class name of t1 in the variable named height.
var height = $(".t1").offset();
//The parameters that go into animate are the first position to move and the second speed.
//Move to the top position of height.
$("html, body").animate({scrollTop: height.top}, 400};
</script>
728x90
LIST
'jQuery' 카테고리의 다른 글
[jQuery] Method / .clone ()-Method to clone selected element (0) | 2022.07.27 |
---|---|
[jQuery] Select all checkboxes, create deselect all (0) | 2022.07.25 |
[jQuery] Create a link that moves smoothly to the top (0) | 2022.07.25 |
[jQuery] Get the horizontal size of the selected element --width, innerWidth, outerWidth (0) | 2022.07.25 |
[jQuery] change image with jquery (0) | 2022.07.22 |