PageSourceSearch

https://job.career-tasu.jp/shared/js/home/drag-scroll.js

js career-tasu.jp collected 2026-10-01 12:11:42 UTC 1,432 bytes, 52 lines download raw bytes

1/*
2  ドラッグスクロールを可能にするjs
3  https://junpei-sugiyama.com/scroll-drag/ よりコピペ
4
5  本ファイルは、headではなくbody最下部で読み込むこと
6*/
7
8// スクロールのドラッグ有効化
9jQuery.prototype.mousedragscrollable = function () {
10  let target;
11  $(this).each(function (i, e) {
12    $(e).mousedown(function (event) {
13      event.preventDefault();
14      target = $(e);
15      $(e).data({
16        down: true,
17        move: false,
18        x: event.clientX,
19        y: event.clientY,
20        scrollleft: $(e).scrollLeft(),
21        scrolltop: $(e).scrollTop(),
22      });
23      return false;
24    });
25    $(e).click(function (event) {
26      if ($(e).data("move")) {
27        return false;
28      }
29    });
30  });
31  $(document)
32    .mousemove(function (event) {
33      if ($(target).data("down")) {
34        event.preventDefault();
35        let move_x = $(target).data("x") - event.clientX;
36        let move_y = $(target).data("y") - event.clientY;
37        if (move_x !== 0 || move_y !== 0) {
38          $(target).data("move", true);
39        } else {
40          return;
41        }
42        $(target).scrollLeft($(target).data("scrollleft") + move_x);
43        $(target).scrollTop($(target).data("scrolltop") + move_y);
44        return false;
45      }
46    })
47    .mouseup(function (event) {
48      $(target).data("down", false);
49      return false;
50    });
51};
52$(".drag-scroll").mousedragscrollable();

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.