Libraryless. Click here for Pure Java version (2918L/17K).
1 | // needs JQuery |
2 | sS hjs_handleScrollToAnchor() { |
3 | ret hjs([[ |
4 | $(window).on("load", function() { |
5 | var anchor = window.location.hash.substr(1); |
6 | var match = anchor.match(/^scrollTo(\d+)$/); |
7 | if (match) { |
8 | var y = parseInt(match[1]); |
9 | console.log("Scrolling to " + y); |
10 | window.scrollTo(0, y); |
11 | } |
12 | }); |
13 | ]]); |
14 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031000 |
Snippet name: | hjs_handleScrollToAnchor - handles an anchor like "#scrollTo123" |
Eternal ID of this version: | #1031000/6 |
Text MD5: | 9976b3d29ec0d55f90f6ab8086924a6f |
Transpilation MD5: | b65d3ef10658eee5be74209d3a4ae07e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-19 16:22:26 |
Source code size: | 366 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 167 / 247 |
Version history: | 5 change(s) |
Referenced in: | [show references] |