PageSourceSearch

https://kobac-kashiwazaki01.com/js2/smoothscroll.js

js kobac-kashiwazaki01.com collected 2026-10-05 11:15:38 UTC 1,076 bytes, 22 lines download raw bytes

1/*
2インクルードしとかないと動かない!!
3<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
4*/
5$(function(){
6  // #で始まるa要素をクリックした場合に処理
7  $('a[href^="#"]').click(function(){
8    // 移動先を0px調整する。0を30にすると30px下にずらすことができる。
9    var adjust = 0;
10    // スクロールの速度(ミリ秒)
11    var speed = 400;
12    // アンカーの値取得 リンク先(href)を取得して、hrefという変数に代入
13    var href= $(this).attr("href");
14    // 移動先を取得 リンク先(href)のidがある要素を探して、targetに代入
15    var target = $(href == "#" || href == "" ? 'html' : href);
16    // 移動先を調整 idの要素の位置をoffset()で取得して、positionに代入
17    var position = target.offset().top + adjust;
18    // スムーススクロール linear(等速) or swing(変速)
19    $('body,html').animate({scrollTop:position}, speed, 'swing');
20    return false;
21  });
22});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.