{"id":6311,"date":"2021-11-30T15:15:06","date_gmt":"2021-11-30T06:15:06","guid":{"rendered":"http:\/\/www.otwo.jp\/blog\/?p=6311"},"modified":"2021-11-30T15:15:06","modified_gmt":"2021-11-30T06:15:06","slug":"mouse-stalker","status":"publish","type":"post","link":"https:\/\/www.otwo.jp\/blog\/mouse-stalker\/","title":{"rendered":"\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u8ffd\u5f93\u3059\u308b\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3092\u81ea\u4f5c\u3059\u308b\u3010JavaScript \/ jQuery\u3011"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2021\/11\/mousestoker.png\" alt=\"\" width=\"700\" height=\"400\" class=\"alignnone size-full wp-image-6436\" srcset=\"https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2021\/11\/mousestoker.png 700w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2021\/11\/mousestoker-150x86.png 150w, https:\/\/www.otwo.jp\/blog\/wp-content\/uploads\/2021\/11\/mousestoker-300x171.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><br \/>\n\u3053\u3093\u306b\u3061\u306fWEB\u306e\u4f50\u91ce\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001WEB\u30b5\u30a4\u30c8\u3067\u305f\u307e\u306b\u898b\u304b\u3051\u308b\u300c\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u300d\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3068\u306f\u3053\u3093\u306a\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"result\" data-slug-hash=\"ZEJpoVy\" data-user=\"otwo\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/otwo\/pen\/ZEJpoVy\"><br \/>\n  Untitled<\/a> by otwo (<a href=\"https:\/\/codepen.io\/otwo\">@otwo<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>\u3053\u306e\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306fWEB\u30b5\u30a4\u30c8\u306e\u6f14\u51fa\u3068\u3057\u3066\u591a\u7528\u3055\u308c\u308b\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u30c6\u30fc\u30de\u306b\u5408\u308f\u305b\u3066\u4f7f\u3046\u3053\u3068\u3067\u3001\u3088\u308a\u4e16\u754c\u89b3\u304c\u51dd\u3089\u308c\u305f\u30b5\u30a4\u30c8\u3092\u6f14\u51fa\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br \/>\n\u5b9f\u88c5\u3082\u3055\u307b\u3069\u96e3\u3057\u304f\u306a\u3044\u306e\u3067\u3001\u305c\u3072\u30a2\u30a4\u30c7\u30a2\u306e\u4e00\u3064\u3068\u3057\u3066\u4f5c\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n<p>\u3053\u3053\u3067\u306f\u5b66\u7fd2\u5411\u3051\u306b\u4f5c\u308a\u306a\u304c\u3089\u30cf\u30de\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3082\u4ea4\u3048\u306a\u304c\u3089\u5b9f\u88c5\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u306e\u3067\u3001\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<br \/>\n<span style=\"color: #f00;font-size:80%;\">\u203b\u3061\u306a\u307f\u306b\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306f\u30b9\u30de\u30db\u3067\u306f\u52d5\u304b\u306a\u3044\u306e\u3067\u8a18\u4e8b\u306e\u95b2\u89a7\u306fPC\u63a8\u5968\u3067\u3059<\/span><\/p>\n<div class=\"pageContents\">\n<p class=\"title\">\u3082\u304f\u3058<\/p>\n<dl>\n<dt><a href=\"#step1\">\u4eca\u56de\u306e\u5b9f\u88c5\u5185\u5bb9<\/a><\/dt>\n<dt><a href=\"#step2\">\u30b7\u30f3\u30d7\u30eb\u306a\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc<\/a><\/dt>\n<dd><a href=\"#step2-1\">CSS : transition\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3<\/a><\/dd>\n<dd><a href=\"#step2-2\">CSS : transform\u3067\u5ea7\u6a19\u6307\u5b9a<\/a><\/dd>\n<dt><a href=\"#step3\">\u6a5f\u80fd\u8ffd\u52a0<\/a><\/dt>\n<dd><a href=\"#step3-1\">CSS : absolute\u3067\u53ef\u52d5\u57df\u3092\u56fa\u5b9a<\/a><\/dd>\n<dd><a href=\"#step3-2\">CSSJS : data\u5c5e\u6027\u3067\u30af\u30e9\u30b9\u3092\u4ed8\u4e0e<\/a><\/dd>\n<\/dl>\n<\/div>\n<h2 id=\"step1\">\u4eca\u56de\u306e\u5b9f\u88c5\u5185\u5bb9<\/h2>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u3068\u5c11\u3057\u8981\u4ef6\u3092\u52a0\u3048\u305f\u3082\u306e\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u6700\u7d42\u7684\u306a\u8981\u4ef6\u306f\u3053\u3061\u3089\u3002<\/p>\n<div style=\"font-size: 90%; background-color: #e6efe6; padding: 2% 2.5%; border-radius: 10px; line-height: 2.0em;\">\n\u25bc\u4f7f\u7528\u30e9\u30a4\u30d6\u30e9\u30ea<br \/>\n\u30fbjQuery<br \/>\n\u25bc\u8981\u4ef6<br \/>\n\u30fb\u30ab\u30fc\u30bd\u30eb\u3092\u8ffd\u5f93\u3059\u308b<br \/>\n\u30fb\u30b5\u30a4\u30c8\u5168\u4f53\u3067\u306f\u306a\u304f\u6307\u5b9a\u3057\u305f\u7bc4\u56f2\u306e\u307f\u3067\u6a5f\u80fd\u3059\u308b<br \/>\n\u30fb\u6307\u5b9a\u7bc4\u56f2\u304b\u3089\u30ab\u30fc\u30bd\u30eb\u304c\u5916\u308c\u308b\u3068\u6307\u5b9a\u3057\u305f\u4f4d\u7f6e\u306b\u623b\u308b<br \/>\n\u30fb\u6307\u5b9a\u8981\u7d20(\u4eca\u56de\u306fa\u30bf\u30b0)\u306b\u30ab\u30fc\u30bd\u30eb\u304c\u5408\u3046\u3068\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u308b\n<\/div>\n<p>\u30b3\u30d4\u30da\u7528\u306e\u30b3\u30fc\u30c9\u3092\u7528\u610f\u3057\u3066\u304a\u304f\u306e\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u306e\u78ba\u8a8d\u7528\u306b\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n<h2 id=\"step2\">\u30b7\u30f3\u30d7\u30eb\u306a\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc<\/h2>\n<p>\u307e\u305a\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u30b3\u30d4\u30da\u306e\u624b\u9593\u304c\u5c11\u306a\u3044\u3088\u3046\u306b1\u30d5\u30a1\u30a4\u30eb\u306b\u5168\u90e8\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\"><code>&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;title&gt;\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc&lt;\/title&gt;\r\n  &lt;meta charset=\"UTF-8\"&gt;\r\n  &lt;style type=\"text\/css\"&gt;\r\n    \/* \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc *\/\r\n    #stkr{\r\n      position: fixed;\r\n      top: 0px;\r\n      left: 0px;\r\n      width: 25px;\r\n      height: 25px;\r\n      background: rgba(0, 0, 0, 0.5);\r\n      border-radius: 50%;\r\n      transition: 0.2s;\r\n      transition-timing-function: ease-out;\r\n      pointer-events: none;\r\n      z-index: 10;\r\n    }\r\n\r\n    \/* \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306b\u5f71\u97ff\u306e\u306a\u3044\u88c5\u98feCSS *\/\r\n    *{ margin: 0;  padding: 0; }\r\n    html, body{ width: 100%; height: 100%; }\r\n    .links div{ margin: 20px 10px; }\r\n  &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n  &lt;div id=\"stkr\"&gt;&lt;\/div&gt;\r\n  &lt;div class=\"links\"&gt;\r\n    &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\"&gt;\u30ea\u30f3\u30af\uff11&lt;\/a&gt;&lt;\/div&gt;\r\n    &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\"&gt;\u30ea\u30fc\u30fc\u30f3\u30af\uff12&lt;\/a&gt;&lt;\/div&gt;\r\n    &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\"&gt;\u30ea\u30fc\u30fc\u30fc\u30fc\u30f3\u30af\uff13&lt;\/a&gt;&lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;!-- JavaScript --&gt;\r\n  &lt;script src=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.11.1\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n  &lt;script type=\"text\/javascript\"&gt;\r\n    \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u95a2\u9023\u306e\u8981\u7d20\uff08\u4efb\u610f\u3067\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\uff09\r\n    const mouseStalker = \"#stkr\";           \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306b\u306a\u308b\u8981\u7d20\u3092\u6307\u5b9a\r\n    const mouseTarget = \".stkr-target\";     \/\/ \u30ea\u30f3\u30af\u306a\u3069\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u305f\u3044\u8981\u7d20\u3092\u6307\u5b9a\r\n    const mouseStalkerArea = window;        \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u304c\u6a5f\u80fd\u3059\u308b\u8981\u7d20\u3092\u6307\u5b9a\r\n\r\n    \/\/ \u51e6\u7406\u3067\u4f7f\u3046\u5909\u6570\u305f\u3061\r\n    const stkrSize = parseInt($(mouseStalker).css(\"width\").replace(\/px\/, \"\"));\r\n    const stkrPosX = parseInt($(mouseStalker).css(\"left\").replace(\/px\/, \"\"));\r\n    const stkrPosY = parseInt($(mouseStalker).css(\"top\").replace(\/px\/, \"\"));\r\n    const cssPosAjust = stkrPosX + (stkrSize \/ 2);\r\n    let scale = 1;\r\n\r\n    \/\/ \u8ffd\u5f93\u7528\u306e\u51e6\u7406\r\n    $(mouseStalkerArea).hover(function(){\r\n      $(mouseStalkerArea).mousemove(function(e){\r\n        let x = e.clientX - cssPosAjust;\r\n        let y = e.clientY - cssPosAjust;\r\n        $(mouseStalker).css({\r\n          \"transform\": \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\",\r\n        });\r\n      });\r\n    });\r\n\r\n    \/\/ \u30ea\u30f3\u30af\u30db\u30d0\u30fc\u306e\u51e6\u7406\r\n    $(mouseTarget).hover(function(e){\r\n      scale = 2;\r\n      let x = e.clientX - cssPosAjust;\r\n      let y = e.clientY - cssPosAjust;\r\n      $(mouseStalker).css({\r\n        \"transform\": \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\",\r\n      });\r\n    }, function(){\r\n      scale = 1;\r\n    });\r\n  &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<\/div>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"result\" data-slug-hash=\"bGrwmjR\" data-user=\"otwo\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/otwo\/pen\/bGrwmjR\"><br \/>\n  Untitled<\/a> by otwo (<a href=\"https:\/\/codepen.io\/otwo\">@otwo<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script><br \/>\n\u4f5c\u308a\u306f\u30b7\u30f3\u30d7\u30eb\u3067<br \/>\n<b>JavaScript\u3067\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u306e\u5ea7\u6a19\u3092\u53d6\u5f97\u3057\u3001\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u5ea7\u6a19\u306b\u53cd\u6620<\/b><br \/>\n\u3053\u308c\u306e\u7e70\u308a\u8fd4\u3057\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u305d\u306e\u307e\u307e\u4f5c\u308b\u3068\u30ab\u30fc\u30bd\u30eb\u306b\u30d4\u30c3\u30bf\u30ea\u3068\u4ed8\u3044\u3066\u304d\u3066\u3057\u307e\u3044\u4e0d\u683c\u597d\u306a\u3082\u306e\u306b\u306a\u308b\u306e\u3067<b>CSS\u3067\u30ab\u30fc\u30bd\u30eb\u306b\u5c11\u3057\u9045\u308c\u3066\u4ed8\u3044\u3066\u304f\u308b\u52d5\u304d<\/b>\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u88c5\u306b\u3042\u305f\u3063\u3066\u3044\u304f\u3064\u304b\u30dd\u30a4\u30f3\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"step2-1\">CSS : transition\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3<\/h3>\n<p>\u5c11\u3057\u9045\u308c\u3066\u4ed8\u3044\u3066\u304f\u308b\u3001\u3092\u5b9f\u88c5\u3059\u308b\u306a\u3089transition\u3092\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>jQuery\u306eanimate\u3067\u51fa\u6765\u308b\u304b\u8a66\u3057\u307e\u3057\u305f\u304c\u3001\u30ab\u30af\u30ab\u30af\u3059\u308b\u52d5\u304d\u306b\u306a\u3063\u305f\u306e\u3068\u4ed6\u306e\u30b5\u30a4\u30c8\u3092\u3044\u304f\u3064\u304b\u898b\u3066\u307f\u307e\u3057\u305f\u304c\u30b3\u30ec\u4e00\u629e\u3067\u3059\u3002<\/p>\n<h3 id=\"step2-2\">CSS : transform\u3067\u5ea7\u6a19\u6307\u5b9a<\/h3>\n<p>\u8981\u7d20\u4f4d\u7f6e\u306e\u64cd\u4f5c\u306b\u306ftransform\u304c\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002<\/p>\n<p>\u4f4d\u7f6e\u64cd\u4f5c\u3060\u3051\u3067\u3042\u308c\u3070\u4ed6\u306b\u3082css\u306etop,left\u3084margin,padding\u3067\u3082\u5b9f\u88c5\u3067\u304d\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u30b5\u30a4\u30ba\u5909\u66f4\u3092\u8996\u91ce\u306b\u5165\u308c\u308b\u306e\u3067\u3042\u308c\u3070\u4f4d\u7f6e\u3001\u30b5\u30a4\u30ba\u30921\u3064\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u64cd\u4f5c\u3067\u304d\u308btransform\u3092\u4f7f\u3046\u306e\u304c\u30b9\u30de\u30fc\u30c8\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2 id=\"step3\">\u6a5f\u80fd\u8ffd\u52a0<\/h2>\n<p>\u3053\u3053\u304b\u3089\u306f\u4e0a\u3067\u4f5c\u3063\u305f\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306b\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<div style=\"font-size: 90%; background-color: #e6efe6; padding: 2% 2.5%; border-radius: 10px; line-height: 2.0em;\">\n\u30fb\u30ea\u30f3\u30af\u30db\u30d0\u30fc\u3067\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u8272\u3092\u5909\u66f4<br \/>\n\u30fb\u30ea\u30f3\u30af\u30db\u30d0\u30fc\u6642\u306b\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u4f4d\u7f6e\u3092\u56fa\u5b9a<br \/>\n\u30fb\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u53ef\u52d5\u7bc4\u56f2\u3092\u8ffd\u52a0\u3057\u3066\u3001\u305d\u308c\u4ee5\u5916\u306f\u56fa\u5b9a\u4f4d\u7f6e\u306b\u623b\u308b\n<\/div>\n<p>\u3053\u308c\u3089\u3092\u76db\u308a\u8fbc\u3093\u3060\u3082\u306e\u304c\u3053\u3061\u3089\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\"><code>&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;title&gt;\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc&lt;\/title&gt;\r\n  &lt;meta charset=\"UTF-8\"&gt;\r\n  &lt;style type=\"text\/css\"&gt;\r\n    \/* \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc *\/\r\n    #stkr{\r\n      position: absolute;\r\n      top: 10px;\r\n      left: 10px;\r\n      width: 25px;\r\n      height: 25px;\r\n      background: rgba(0, 0, 0, 0.5);\r\n      border-radius: 50%;\r\n      transition: 0.2s;\r\n      transition-timing-function: ease-out;\r\n      pointer-events: none;\r\n      z-index: 10;\r\n    }\r\n    \/* \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u53ef\u52d5\u7bc4\u56f2 *\/\r\n    #stkr-area{\r\n      width: 100%;\r\n      height: 300px;\r\n      padding: 10px;\r\n      box-sizing: border-box;\r\n      position: relative;\r\n      background-color: rgb(184, 149, 247, 0.5);\r\n    }\r\n    \/* \u30db\u30d0\u30fc\u3057\u305f\u6642\u306e\u8272 *\/\r\n    .color1{ background-color: rgb(247, 77, 155, 0.5) !important; }\r\n    .color2{ background-color: rgb(77, 200, 247, 0.6) !important; }\r\n    .color3{ background-color: rgb(77, 247, 82, 0.5) !important; }\r\n\r\n    \/* \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306b\u5f71\u97ff\u306e\u306a\u3044\u88c5\u98feCSS *\/\r\n    *{ margin: 0;  padding: 0; }\r\n    html, body{ width: 100%; height: 100%; }\r\n    .ttl{ padding-left: 30px; }\r\n    .links div{ margin: 20px 10px; }\r\n  &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n  &lt;div id=\"stkr-area\"&gt;\r\n    &lt;div id=\"stkr\"&gt;&lt;\/div&gt;\r\n    &lt;div class=\"ttl\"&gt;\u2190\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc&lt;\/div&gt;\r\n    &lt;div class=\"links\"&gt;\r\n      &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\" data-color=\"color1\"&gt;\u30ea\u30f3\u30af\uff11&lt;\/a&gt;&lt;\/div&gt;\r\n      &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\" data-color=\"color2\"&gt;\u30ea\u30fc\u30fc\u30f3\u30af\uff12&lt;\/a&gt;&lt;\/div&gt;\r\n      &lt;div&gt;&lt;a href=\"#\" class=\"stkr-target\" data-color=\"color3\"&gt;\u30ea\u30fc\u30fc\u30fc\u30fc\u30f3\u30af\uff13&lt;\/a&gt;&lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;!-- JavaScript --&gt;\r\n  &lt;script src=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.11.1\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n  &lt;script type=\"text\/javascript\"&gt;\r\n    \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u95a2\u9023\u306e\u8981\u7d20\uff08\u4efb\u610f\u3067\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\uff09\r\n    const mouseStalker = \"#stkr\";           \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306b\u306a\u308b\u8981\u7d20\u3092\u6307\u5b9a\r\n    const mouseTarget = \".stkr-target\";     \/\/ \u30ea\u30f3\u30af\u306a\u3069\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u4ed8\u3051\u305f\u3044\u8981\u7d20\u3092\u6307\u5b9a\r\n    const mouseStalkerArea = \"#stkr-area\";  \/\/ \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u304c\u6a5f\u80fd\u3059\u308b\u8981\u7d20\u3092\u6307\u5b9a\r\n\r\n    \/\/ \u51e6\u7406\u3067\u4f7f\u3046\u5909\u6570\u305f\u3061\r\n    const stkrSize = parseInt($(mouseStalker).css(\"width\").replace(\/px\/, \"\"));\r\n    const stkrPosX = parseInt($(mouseStalker).css(\"left\").replace(\/px\/, \"\"));\r\n    const stkrPosY = parseInt($(mouseStalker).css(\"top\").replace(\/px\/, \"\"));\r\n    const cssPosAjust = stkrPosX + (stkrSize \/ 2);\r\n    let stkrFix = false;\r\n    let scale = 1;\r\n    let scroll = 0;\r\n\r\n    \/\/ \u8ffd\u5f93\u7528\u306e\u51e6\u7406\r\n    $(mouseStalkerArea).hover(function(){\r\n      $(mouseStalkerArea).mousemove(function(e){\r\n        if(stkrFix == false){\r\n          let x = e.clientX - cssPosAjust;\r\n          let y = e.clientY + scroll - cssPosAjust;\r\n          $(mouseStalker).css({\r\n            \"transform\": \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\",\r\n          });\r\n        }\r\n      });\r\n    }, function(){\r\n      $(mouseStalker).css({\r\n        \"transform\": \"\"\r\n      });\r\n    });\r\n\r\n    \/\/ \u30ea\u30f3\u30af\u30db\u30d0\u30fc\u306e\u51e6\u7406\r\n    $(mouseTarget).hover(function(){\r\n      stkrFix = true;\r\n      scale = 2;\r\n      let _width = parseInt($(this).css(\"width\").replace(\/px\/,\"\"));\r\n      let _top = $(this).position().top;\r\n      let _left = $(this).position().left;\r\n      let x = _left - stkrPosX - (stkrSize \/ 2) + (_width \/ 2);\r\n      let y = _top - stkrPosX;\r\n      $(mouseStalker).css({\r\n        \"transform\": \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\",\r\n      }).addClass($(this).data(\"color\"));\r\n    }, function(){\r\n      stkrFix = false;\r\n      scale = 1;\r\n      $(mouseStalker).removeClass($(this).data(\"color\"));\r\n    });\r\n\r\n    $(window).scroll(function(){\r\n      scroll = $(window).scrollTop();\r\n    });\r\n  &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<\/div>\n<p>\u30bd\u30fc\u30b9\u304c\u9577\u304f\u306a\u3063\u3066\u7533\u3057\u8a33\u306a\u3044\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u4eca\u56de\u306e\u5b8c\u6210\u5f62\u3067\u3059\u3002<\/p>\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"result\" data-slug-hash=\"ZEJpoVy\" data-user=\"otwo\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/otwo\/pen\/ZEJpoVy\"><br \/>\n  Untitled<\/a> by otwo (<a href=\"https:\/\/codepen.io\/otwo\">@otwo<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/cpwebassets.codepen.io\/assets\/embed\/ei.js\"><\/script><br \/>\n\u3061\u3089\u307b\u3089\u3068\u624b\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u304c\u30dd\u30a4\u30f3\u30c8\u306b\u306a\u308a\u305d\u3046\u306a\u3068\u3053\u308d\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"step3-1\">CSS : absolute\u3067\u53ef\u52d5\u57df\u3092\u56fa\u5b9a<\/h3>\n<p>\u30b7\u30f3\u30d7\u30eb\u306a\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3067\u306fcss\u306eposition\u306b\u30b5\u30a4\u30c8\u5168\u4f53\u3067\u52d5\u304f\u3088\u3046\u306bfixed\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u5b8c\u6210\u5f62\u3067\u306f\u7279\u5b9a\u306e\u7bc4\u56f2\u3067\u306e\u307f\u6a5f\u80fd\u3059\u308b\u3088\u3046\u306bfixed \u2192 absolute\u306b\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306b\u4f34\u3063\u3066\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u767a\u751f\u3059\u308b\u3068\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3068\u30ab\u30fc\u30bd\u30eb\u306e\u4f4d\u7f6e\u306b\u30ba\u30ec\u308b\u73fe\u8c61\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u3001JavaScript\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u91cf\u3092\u4fdd\u6301\u3057\u306a\u304c\u3089\u4f4d\u7f6e\u8a08\u7b97\u6642\u306b\u52a0\u7b97\u3059\u308b\u5bfe\u5fdc\u3092\u52a0\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3 id=\"step3-2\">JS : data\u5c5e\u6027\u3067\u30af\u30e9\u30b9\u3092\u4ed8\u4e0e<\/h3>\n<p>\u4eca\u56de\u3001\u30db\u30d0\u30fc\u3067\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u306e\u8272\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406\u306b\u306fdata\u5c5e\u6027\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306edata\u5c5e\u6027\u306fHTML\u3068JavaScript\u3067\u4efb\u610f\u306e\u30c7\u30fc\u30bf\u3092\u3084\u308a\u53d6\u308a\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u975e\u5e38\u306b\u4f7f\u3044\u52dd\u624b\u304c\u3044\u3044\u306e\u3067\u899a\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\"><code>\u25bc\u6307\u5b9a\u65b9\u6cd5(\u30bf\u30b0\u306f\u306a\u3093\u3067\u3082OK)\r\n&lt;a href=\"#\" data-[\u4efb\u610f]=\"\u306a\u3093\u3067\u3082OK\"&gt;\r\n\u306e\u5f62\u5f0f\u3067HTML\u30bf\u30b0\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002\r\n\u4f8b\uff09\r\n&lt;a href=\"#\" data-test=\"\u306a\u3093\u3067\u3082OK\"&gt;\r\n\r\n\u25bcjQuery\u3067\u5024\u306e\u53d6\u5f97\r\n$(\"a\").data(\"[\u4efb\u610f]\");\r\n\u4f8b)\r\nconsole.log($(\"a\").data(\"test\"));   \/\/ \u7d50\u679c\uff1a\u306a\u3093\u3067\u3082OK\r\n<\/code><\/pre>\n<\/div>\n<p>\u8981\u7d20\u3054\u3068\u306b\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3067\u51e6\u7406\u3057\u305f\u3044\u6642\u306b\u91cd\u5b9d\u3057\u307e\u3059\u3002<\/p>\n<hr>\n<\/hr>\n<p>\u3044\u304b\u304c\u3060\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u30e2\u30d0\u30a4\u30eb\u30d5\u30a1\u30fc\u30b9\u30c8\u306e\u30b5\u30a4\u30c8\u304c\u591a\u304f\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u6d3b\u7528\u5834\u9762\u306f\u9650\u3089\u308c\u307e\u3059\u304c\u3001\u4e00\u77ac\u3067\u3082\u30e6\u30fc\u30b6\u30fc\u306e\u76ee\u3092\u5f15\u3051\u308b\u30ae\u30df\u30c3\u30af\u306f\u898b\u3066\u3044\u3066\u697d\u3057\u3044\u3067\u3059\u3088\u306d\uff01<br \/>\n\u8272\u3093\u306a\u3044\u30a2\u30a4\u30c7\u30a2\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4e0a\u624b\u304f\u4f7f\u3048\u305f\u3089\u9762\u767d\u3044\u3068\u601d\u3046\u306e\u3067\u305c\u3072\u81ea\u5206\u6d41\u306b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\uff01<br \/>\n\u305d\u308c\u3067\u306f\u307e\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306fWEB\u306e\u4f50\u91ce\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001WEB\u30b5\u30a4\u30c8\u3067\u305f\u307e\u306b\u898b\u304b\u3051\u308b\u300c\u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u300d\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u30de\u30a6\u30b9\u30b9\u30c8\u30fc\u30ab\u30fc\u3068\u306f\u3053\u3093\u306a\u3082\u306e\u306b\u306a\u308a\u307e\u3059\u3002 See the Pen Untitled by otwo (@ [&hellip;]<\/p>\n","protected":false},"author":25,"featured_media":6437,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[83,93,94],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/6311"}],"collection":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/comments?post=6311"}],"version-history":[{"count":86,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/6311\/revisions"}],"predecessor-version":[{"id":6450,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/posts\/6311\/revisions\/6450"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media\/6437"}],"wp:attachment":[{"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/media?parent=6311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/categories?post=6311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.otwo.jp\/blog\/wp-json\/wp\/v2\/tags?post=6311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}