{"id":18762350,"url":"https://github.com/jogiter/scroll2","last_synced_at":"2026-03-19T06:14:17.786Z","repository":{"id":55596500,"uuid":"132731455","full_name":"Jogiter/scroll2","owner":"Jogiter","description":"scroll to anywhere, using requestAnimationFrame","archived":false,"fork":false,"pushed_at":"2020-12-19T10:50:43.000Z","size":670,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-27T04:08:49.545Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jogiter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-09T09:10:31.000Z","updated_at":"2023-03-08T23:13:19.000Z","dependencies_parsed_at":"2022-08-15T04:00:44.898Z","dependency_job_id":null,"html_url":"https://github.com/Jogiter/scroll2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Jogiter/scroll2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jogiter%2Fscroll2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jogiter%2Fscroll2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jogiter%2Fscroll2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jogiter%2Fscroll2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jogiter","download_url":"https://codeload.github.com/Jogiter/scroll2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jogiter%2Fscroll2/sbom","scorecard":{"id":73461,"data":{"date":"2025-08-11","repo":{"name":"github.com/Jogiter/scroll2","commit":"042a20c693f7455c1b66c72673a3f47db2dc3d95"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Do What The F*ck You Want To Public License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T04:20:13.887Z","repository_id":55596500,"created_at":"2025-08-15T04:20:13.887Z","updated_at":"2025-08-15T04:20:13.887Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281896637,"owners_count":26580138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T18:20:38.945Z","updated_at":"2025-10-30T22:38:11.569Z","avatar_url":"https://github.com/Jogiter.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## scroll2\n\nLightweight, cross-browser and highly customizable animated scrolling\n\n### install\n\n\u003eyarn add scroll2\n\n### usage\n\n\u003escroll2(scrollY = 0, duration = 1000, callback)\n\n|param|type|description|\n|:----|:----|:----|\n|scrollY|Number|scroll end position|\n|duration|Number|scroll duration, default 1000|\n|callback|Function|callback when scroll ended|\n\n```js\nconst scroll2 = require('scroll2');\nscroll2(1000, 500, (scrollY) =\u003e {\n  console.log(`scroll end at ${scrollY}`);\n})\n```\n\n### [使用 javascript 获取视口/窗口大小（宽度和高度）](https://andylangton.co.uk/blog/development/get-viewportwindow-size-width-and-height-javascript)\n\n----\n\n### 使用 jQuery 方法获取窗口或文档的大小\n\n```js\n$(window).height() // returns height of browser viewport\n$(document).height() // returns height of HTML document (same as pageHeight in screenshot)\n$(window).width() // returns width of browser viewport\n$(document).width() // returns width of HTML document (same as pageWidth in screenshot)\n```\n\n### [使用原生 js 方法获取窗口的大小](http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/)\n\n**长版本**\n\n```html\n\u003cscript type=\"text/javascript\"\u003e\n  var viewportwidth\n  var viewportheight\n  // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight\n  if (typeof window.innerWidth != 'undefined') {\n    viewportwidth = window.innerWidth\n    viewportheight = window.innerHeight\n  } else if (\n    typeof document.documentElement != 'undefined' \u0026\u0026\n    typeof document.documentElement.clientWidth != 'undefined' \u0026\u0026\n    document.documentElement.clientWidth != 0\n  ) {\n    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)\n    viewportwidth = document.documentElement.clientWidth\n    viewportheight = document.documentElement.clientHeight\n  } else {\n    // older versions of IE\n    viewportwidth = document.getElementsByTagName('body')[0].clientWidth\n    viewportheight = document.getElementsByTagName('body')[0].clientHeight\n  }\n  document.write(\n    '\u003cp\u003eYour viewport width is ' + viewportwidth + 'x' + viewportheight + '\u003c/p\u003e'\n  )\n\u003c/script\u003e\n```\n\n**短版本**\n\n返回对象\n\n```js\nfunction viewport() {\n  var e = window,\n    a = 'inner'\n  if (!('innerWidth' in window)) {\n    a = 'client'\n    e = document.documentElement || document.body\n  }\n  return { width: e[a + 'Width'], height: e[a + 'Height'] }\n}\n```\n\n返回变量\n\n```js\nvar w = window,\n  d = document,\n  e = d.documentElement,\n  g = d.getElementsByTagName('body')[0],\n  x = w.innerWidth || e.clientWidth || g.clientWidth,\n  y = w.innerHeight || e.clientHeight || g.clientHeight\nconsole.log(x + ' × ' + y)\n```\n\n### [使用原生 js 方法获取文档的大小](http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/)\n\n```js\nconst body = document.body\nconst html = document.documentElement\n\nlet height = Math.max(\n  body.scrollHeight,\n  body.offsetHeight,\n  html.clientHeight,\n  html.scrollHeight,\n  html.offsetHeight\n)\n```\n\n### 获取页面可滚动区域高度\n\n```js\nfunction getScrollHeight() {\n  let body = document.body\n  let html = document.documentElement\n  let height = Math.max(\n    body.scrollHeight,\n    body.offsetHeight,\n    html.clientHeight,\n    html.scrollHeight,\n    html.offsetHeight\n  )\n  let viewportHeight =\n    window.innerHeight ||\n    document.documentElement.clientHeight ||\n    document.getElementsByTagName('body')[0].clientHeight\n\n  return height \u003e viewportHeight ? height - viewportHeight : 0\n}\n```\n\n### 获取网页元素的绝对位置\n\n```js\nfunction getElementLeft(element){\n  var actualLeft = element.offsetLeft;\n  var current = element.offsetParent;\n\n  while (current !== null){\n    actualLeft += current.offsetLeft;\n    current = current.offsetParent;\n  }\n\n  return actualLeft;\n}\n\nfunction getElementTop(element){\n  var actualTop = element.offsetTop;\n  var current = element.offsetParent;\n\n  while (current !== null){\n    actualTop += current.offsetTop;\n    current = current.offsetParent;\n  }\n\n  return actualTop;\n}\n```\n\n\n### 阅读链接\n\n* [stackoverflow: get-the-size-of-the-screen-current-web-page-and-browser-window](https://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window)\n* [Get viewport/window size (width and height) with javascript](https://andylangton.co.uk/blog/development/get-viewportwindow-size-width-and-height-javascript)\n* [How to get height of entire document with JavaScript?\n  ](https://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript)\n* [用Javascript获取页面元素的位置](http://www.ruanyifeng.com/blog/2009/09/find_element_s_position_using_javascript.html)\n\n### LISENCE\n\n[wtfpl](http://www.wtfpl.net/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjogiter%2Fscroll2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjogiter%2Fscroll2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjogiter%2Fscroll2/lists"}