{"id":4705,"date":"2019-10-04T03:51:24","date_gmt":"2019-10-03T18:51:24","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=4705"},"modified":"2019-10-04T03:51:24","modified_gmt":"2019-10-03T18:51:24","slug":"vue%e3%81%a0%e3%81%91%e3%81%a7%e3%81%a4%e3%81%8f%e3%82%8b%ef%bc%81%e3%83%9a%e3%83%bc%e3%82%b8%e3%83%88%e3%83%83%e3%83%97%e3%81%b8%e8%87%aa%e5%8b%95%e3%82%b9%e3%82%af%e3%83%ad%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=4705","title":{"rendered":"Vue\u3060\u3051\u3067\u3064\u304f\u308b\uff01\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u3078\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08DL\u53ef\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306f<a href=\"https:\/\/blog.capilano-fw.com\/?p=4675\">\u6642\u30fb\u5206\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u5165\u529b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/a>\u3067\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\u304c\u30c6\u30fc\u30de\u306e\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u3082\u305d\u306e\u6d41\u308c\u3067\u300c\u3042\u308c\u3070\u5730\u5473\u306b\u4fbf\u5229\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306f\u4f55\u304b\u3068\u8a00\u3046\u3068<strong>\u300c\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30da\u30fc\u30b8\u306e\u4e00\u756a\u4e0a\u307e\u3067\u81ea\u52d5\u7684\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u304f\u308c\u308b\u300d<\/strong>\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u7279\u306b\u30da\u30fc\u30b8\u304c\u7e26\u306b\u9577\u3044\u5834\u5408\u3060\u3068\u4fbf\u5229\u306a\u3093\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u4e00\u756a\u4e0a\u307e\u3067\u79fb\u52d5\u3057\u3066\u304f\u308c\u305f\u3089\u4fbf\u5229\u3058\u3083\u3042\u308a\u307e\u305b\u3093\u304b\uff1f\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4706\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/10\/vue_move_to_top_1.png\" alt=\"\" width=\"86\" height=\"62\" \/><\/p>\n<p>\u306a\u304a\u3001\u5b9f\u306f\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u90e8\u5206\u306f<code>JavaScript<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30d1\u30a4\u30aa\u30cb\u30a2<code>jQuery<\/code>\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u3050\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>$('html,body').animate({\r\n    scrollTop: 0\r\n}, 1000); \/\/ 1\u79d2\u3067\u79fb\u52d5<\/pre>\n<p>\u3067\u3082\uff01<\/p>\n<p>\u6700\u8fd1\u306f<code>jQuery<\/code>\u3092\u4f7f\u308f\u306a\u3044\u30b5\u30a4\u30c8\u3082\u3058\u308f\u3058\u308f\u5897\u3048\u3064\u3064\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u4eca\u56de\u306f<code>jQuery<\/code>\u306f\u4e00\u5207\u4f7f\u308f\u305a<code>Vue<\/code>\u3068<code>JavaScript<\/code>\u3060\u3051\u3067\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Vue 2.6<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u305b\u3063\u304b\u304f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5316\u3059\u308b\u306e\u3067\u3001\u6b21\u306e\u3088\u3046\u306a\uff17\u3064\u306e\u7279\u5fb4\u304c\u3042\u308b\u30dc\u30bf\u30f3\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\uff08\u3057\u304b\u3082\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3059\u308b\uff09<\/li>\n<li>\u30dc\u30bf\u30f3\u306f\u3042\u308b\u4e00\u5b9a\u4ee5\u4e0a\u30b9\u30af\u30ed\u30fc\u30eb\u3055\u308c\u305f\u6642\u3060\u3051\u8868\u793a<\/li>\n<li>\u8868\u793a\uff0f\u975e\u8868\u793a\u306e\u306f\u30ab\u30c3\u30b3\u826f\u304f\u300c\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u300d\uff06\u300c\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u300d<\/li>\n<li>\u30dc\u30bf\u30f3\u3092\u30da\u30fc\u30b8\u306e\u5de6\u4e0a\u30fb\u53f3\u4e0a\u30fb\u5de6\u4e0b\u30fb\u53f3\u4e0b\u306e\u3069\u308c\u304b\u306b\u56fa\u5b9a\u3059\u308b<\/li>\n<li>\u79fb\u52d5\u3059\u308b\u901f\u5ea6\uff08\u79d2\u6570\uff09\u3092\u6307\u5b9a\u3067\u304d\u308b<\/li>\n<li>\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u306f\u81ea\u7531\u306b\u5909\u66f4\u53ef\u80fd<\/li>\n<li>CSS\u3060\u3063\u3066\u81ea\u7531\u306b\u8ffd\u52a0\u3067\u304d\u3061\u3083\u3046\uff01<\/li>\n<\/ol>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h1>Vue\u3067\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u306b\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4eca\u56de\u3082<code>Vue<\/code>\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308b\u3088\u3046\u306b\u9806\u3092\u8ffd\u3063\u3066\u8aac\u660e\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>Vue\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u57fa\u672c\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u3092<code>cdn<\/code>\uff08\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\uff09\u304b\u3089<code>Vue<\/code>\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001<strong>\u300cv-move-to-top\u300d<\/strong>\u3068\u3044\u3046\u540d\u524d\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;div id=\"app\"&gt;\r\n\r\n    &lt;!-- \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 --&gt;\r\n    <strong>&lt;v-move-to-top&gt;&lt;\/v-move-to-top&gt;<\/strong>\r\n\r\n&lt;\/div&gt;\r\n<strong>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.0\"&gt;&lt;\/script&gt;<\/strong>\r\n&lt;script&gt;\r\n\r\n    <strong>Vue.component('v-move-to-top', {<\/strong>\r\n<strong>        template: '&lt;button type=\"button\"&gt;\u4e0a\u3078&lt;\/button&gt;'<\/strong>\r\n<strong>    });<\/strong>\r\n\r\n    new Vue({\r\n        el: '#app'\r\n    });\r\n\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f\u7b2c\uff11\u5f15\u6570\u306b\u540d\u524d\u3001\u305d\u3057\u3066\u7b2c\uff12\u5f15\u6570\u306b\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>template<\/code>\u306f\u5b9f\u969b\u306b\u76ee\u306b\u898b\u3048\u308bHTML\u3092\u6307\u5b9a\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u306e\u6bb5\u968e\u3067\u306f\u6b21\u306e\u3088\u3046\u306a\u3001\u666e\u901a\u306e\u30dc\u30bf\u30f3\u304c\u8868\u793a\u3055\u308c\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4707\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/10\/vue_move_to_top_2.png\" alt=\"\" width=\"61\" height=\"44\" \/><\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u30dc\u30bf\u30f3\u3092\u57fa\u672c\u3068\u3057\u3066\u3044\u308d\u3044\u308d\u306a\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u3078\u79fb\u52d5\u3059\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u3067\u306f\u3001\u30e1\u30a4\u30f3\u306b\u306a\u308b\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-move-to-top', {\r\n    template: '&lt;button type=\"button\" <strong>@click=\"moveToTop\"<\/strong>&gt;\u4e0a\u3078&lt;\/button&gt;',\r\n    <strong>methods: {<\/strong>\r\n<strong>        moveToTop() {<\/strong>\r\n\r\n<strong>            const duration = 1000;  \/\/ \u79fb\u52d5\u901f\u5ea6\uff081\u79d2\u3067\u7d42\u4e86\uff09<\/strong>\r\n<strong>            const interval = 25;    \/\/ 0.025\u79d2\u3054\u3068\u306b\u79fb\u52d5<\/strong>\r\n<strong>            const step = -window.scrollY \/ Math.ceil(duration \/ interval); \/\/ 1\u56de\u306b\u79fb\u52d5\u3059\u308b\u8ddd\u96e2<\/strong>\r\n<strong>            const timer = setInterval(() =&gt; {<\/strong>\r\n\r\n<strong>                window.scrollBy(0, step);   \/\/ \u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u3092\u79fb\u52d5<\/strong>\r\n\r\n<strong>                if(window.scrollY &lt;= 0) {<\/strong>\r\n\r\n<strong>                    clearInterval(timer);<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            }, interval);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u3092\u79fb\u52d5\u3055\u305b\u308b<code>moveToTop()<\/code>\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u3001\u3055\u3089\u306b\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u30af\u30ea\u30c3\u30af\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u5148\u307b\u3069\u306e\u30dc\u30bf\u30f3\u306b<code>@click=\"\"<\/code>\u3067\u30bb\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u306f<code>setInterval()<\/code>\u3092\u4f7f\u3063\u3066<code>0.025\u79d2<\/code>\u3054\u3068\u306b\u4f55\u5ea6\u3082\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u305d\u306e\u5ea6\u306b<code>scrollBy()<\/code>\u3067\u5c11\u3057\u305a\u3064\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u304c\u5909\u66f4\u3059\u308b\u306e\u3067\u3001\u3042\u305f\u304b\u3082\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u3088\u3046\u306b\u5c11\u3057\u305a\u3064\u79fb\u52d5\u3059\u308b\u3088\u3046\u306b\u898b\u3048\u308b\u3068\u3044\u3046\u8a33\u3067\u3059\u306d\u3002<\/p>\n<h2>\u7279\u5b9a\u306e\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u3067\u8868\u793a\u30fb\u975e\u8868\u793a\u3092\u5207\u308a\u66ff\u3048\u308b<\/h2>\n<p>\u3067\u306f\u7d9a\u3044\u3066\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u306b\u3088\u3063\u3066\u30dc\u30bf\u30f3\u3092\u300c\u8868\u793a\uff0f\u975e\u8868\u793a\u300d\u306b\u3059\u308b\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u306a\u305c\u3053\u3093\u306a\u6a5f\u80fd\u3092\u3064\u3051\u308b\u304b\u3068\u3044\u3046\u3068\u3001<\/p>\n<p><strong>\u300c\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u306a\u3044\u306e\u306b &#8220;\u4e0a\u3078&#8221; \u30dc\u30bf\u30f3\u304c\u8868\u793a\u3055\u308c\u306e\u306f\u3001\u3061\u3087\u3063\u3068\u90aa\u9b54\u30fb\u30fb\u30fb\ud83d\ude05\u300d<\/strong><\/p>\n<p>\u3060\u304b\u3089\u3067\u3059\u3002\u3057\u304b\u3082\u3001\u305d\u308c\u307b\u3069\u7e26\u304c\u9577\u304f\u306a\u3044\u30da\u30fc\u30b8\u306f\u30b9\u30af\u30ed\u30fc\u30eb\u81ea\u4f53\u304c\u5fc5\u8981\u306a\u3044\u306e\u3067\u3001\u81ea\u52d5\u7684\u306b\u975e\u8868\u793a\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\u7684\u306b\u306f\u30b0\u30c3\u30c9\uff01\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre>Vue.component('v-move-to-top', {\r\n    <strong>data() {<\/strong>\r\n<strong>        return {<\/strong>\r\n<strong>            show: false<\/strong>\r\n<strong>        };<\/strong>\r\n<strong>    }<\/strong>,\r\n    template: '<strong>&lt;transition name=\"fade\"&gt;<\/strong>'+\r\n        '&lt;button type=\"button\" <strong>v-if=\"show\"<\/strong> @click=\"moveToTop\"&gt;\u4e0a\u3078&lt;\/button&gt;'+\r\n        '<strong>&lt;\/transition&gt;<\/strong>',\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    <strong>mounted() {<\/strong>\r\n\r\n<strong>        \/\/ CSS\u3092\u8ffd\u52a0<\/strong>\r\n<strong>        let style = document.createElement('style');<\/strong>\r\n<strong>        style.innerHTML = `<\/strong>\r\n<strong>                    .fade-enter-active, .fade-leave-active {<\/strong>\r\n<strong>                        transition: opacity .5s;<\/strong>\r\n<strong>                    }<\/strong>\r\n<strong>                    .fade-enter, .fade-leave-to {<\/strong>\r\n<strong>                        opacity: 0;<\/strong>\r\n<strong>                    }<\/strong>\r\n<strong>                `;<\/strong>\r\n<strong>        document.getElementsByTagName('head')[0].appendChild(style);<\/strong>\r\n\r\n<strong>        \/\/ \u30b9\u30af\u30ed\u30fc\u30eb\u30fb\u30a4\u30d9\u30f3\u30c8\u3092\u8ffd\u52a0<\/strong>\r\n<strong>        window.addEventListener('scroll', () =&gt; {<\/strong>\r\n\r\n<strong>            this.show = (window.scrollY &gt; 150);<\/strong>\r\n\r\n<strong>        });<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n});<\/pre>\n<p>\u307e\u305a\u3053\u306e\u4e2d\u3067\u5909\u66f4\u3057\u305f\u306e\u306f\u3001\u307e\u305a<code>template<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u306f\u3001<code>&lt;button&gt;\u301c&lt;\/button&gt;<\/code>\u3060\u3051\u3067\u3057\u305f\u304c\u3001\u305d\u306e\u5916\u5074\u3092<code>&lt;transition name=\"fade\"&gt;\u301c&lt;\/transition&gt;<\/code>\u3067\u56f2\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>mounted()<\/code>\u5185\u3067\u3001\u3053\u306e\u30bf\u30b0\u304c\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\uff06\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u306b\u5fc5\u8981\u306a\u4ee5\u4e0b\u306e<code>CSS<\/code>\u3092\u300c\u30da\u30fc\u30b8\u672c\u4f53\u300d\u306b\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><strong>\/\/ name \u304c \"fade\" \u306a\u306e\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\r\n\r\n.fade-enter-active, .fade-leave-active {<\/strong>\r\n<strong>    transition: opacity .5s;<\/strong>\r\n<strong>}<\/strong>\r\n<strong>.fade-enter, .fade-leave-to {<\/strong>\r\n<strong>    opacity: 0;<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u203b JS\u5185\u3067CSS\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u306b\u306f\u8b70\u8ad6\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3072\u3068\u3064\u3060\u3051\u3067\u5b8c\u7d50\u3055\u305b\u308b\u305f\u3081\u306b\u3042\u3048\u3066\u3053\u306e\u5f62\u3092\u3068\u308a\u307e\u3057\u305f\u3002\u6c17\u306b\u306a\u308b\u65b9\u306f\u901a\u5e38\u901a\u308aCSS\u3067\u5b9a\u7fa9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001\u8868\u793a\uff0f\u975e\u8868\u793a\u3092\u5207\u308a\u66ff\u3048\u308b\u305f\u3081\u306b<code>show<\/code>\u5909\u6570\u3092\u5b9a\u7fa9\u3057\u3066\u30dc\u30bf\u30f3\u306b<code>v-if=\"show\"<\/code>\u3068\u3057\u3066\u8ffd\u52a0\u3057\u3001\u3055\u3089\u306b\u305d\u306e\u5207\u308a\u66ff\u308f\u308a\u306f\u30b9\u30af\u30ed\u30fc\u30eb\u30fb\u30a4\u30d9\u30f3\u30c8\u3067\u300c\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u304c<code>150<\/code>\u3092\u8d85\u3048\u3066\u308b\u304b\u3069\u3046\u304b\u300d\u3067\u5224\u65ad\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u304c\u5b9f\u88c5\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30dc\u30bf\u30f3\u3092\u30da\u30fc\u30b8\u306e\u5de6\u4e0a\u30fb\u53f3\u4e0a\u30fb\u5de6\u4e0b\u30fb\u53f3\u4e0b\u306b\u56fa\u5b9a\u3059\u308b<\/h2>\n<p>\u3067\u306f\u3001\u7d9a\u3044\u3066\u30dc\u30bf\u30f3\u3092\u3069\u3053\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u3044\u3066\u3082\u5e38\u306b\u3001<\/p>\n<ul>\n<li>\u5de6\u4e0a<\/li>\n<li>\u53f3\u4e0a<\/li>\n<li>\u5de6\u4e0b<\/li>\n<li>\u53f3\u4e0b<\/li>\n<\/ul>\n<p>\u3067\u56fa\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>Vue.component('v-move-to-top', {\r\n    <strong>props: ['position'],<\/strong>\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    template: '&lt;transition name=\"fade\"&gt;'+\r\n        '&lt;button type=\"button\" <strong>:style=\"styles\"<\/strong> v-if=\"show\" @click=\"moveToTop\"&gt;\u4e0a\u3078&lt;\/button&gt;'+\r\n        '&lt;\/transition&gt;',\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    <strong>computed: {<\/strong>\r\n<strong>        styles() {<\/strong>\r\n\r\n<strong>            let styles = { position: 'fixed' };<\/strong>\r\n\r\n<strong>            if(this.position === 'top-left') {<\/strong>\r\n\r\n<strong>                styles['top'] = '15px';<\/strong>\r\n<strong>                styles['left'] = '10px';<\/strong>\r\n\r\n<strong>            } else if(this.position === 'top-right') {<\/strong>\r\n\r\n<strong>                styles['top'] = '15px';<\/strong>\r\n<strong>                styles['right'] = '10px';<\/strong>\r\n\r\n<strong>            } else if(this.position === 'bottom-left') {<\/strong>\r\n\r\n<strong>                styles['bottom'] = '15px';<\/strong>\r\n<strong>                styles['left'] = '10px';<\/strong>\r\n\r\n<strong>            } else {<\/strong>\r\n\r\n<strong>                styles['bottom'] = '15px';<\/strong>\r\n<strong>                styles['right'] = '10px';<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            return styles;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    },<\/strong>\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n});<\/pre>\n<p>\u3053\u3053\u3067\u3084\u3063\u305f\u3053\u3068\u306f\u3001\u307e\u305a<code>props<\/code>\u306e\u8ffd\u52a0\u3067\u3059\u3002<br \/>\n\u3053\u308c\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<pre>&lt;!-- \u30dc\u30bf\u30f3\u3092\u5de6\u4e0b\u3067\u56fa\u5b9a --&gt;\r\n&lt;v-move-to-top <strong>position=\"bottom-left\"<\/strong>&gt;&lt;\/v-move-to-top&gt;<\/pre>\n<p>\u3064\u307e\u308a\u3001\u30da\u30fc\u30b8\u306e\u3069\u306e\u4f4d\u7f6e\u306b\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3059\u308b\u304b\u306f<code>position<\/code>\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e<code>position<\/code>\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u3088\u3063\u3066\u4f4d\u7f6e\u3092\u56fa\u5b9a\u3059\u308b\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u3092\u4f5c\u3063\u3066\u3044\u308b\u306e\u304c<code>computed<\/code>\u306e<code>styles()<\/code>\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<code>position<\/code>\u304c<code>top-right<\/code>\u306e\u5834\u5408\u3001\u4f5c\u6210\u3055\u308c\u308b\u30b9\u30bf\u30a4\u30eb\u30b7\u30fc\u30c8\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>{\r\n    position: 'fixed',\r\n    top: '15px',\r\n    right: '10px'\r\n}<\/pre>\n<p>\u6700\u5f8c\u306b\u30dc\u30bf\u30f3\u306b<code>:style=\"styles\"<\/code>\u3068\u3057\u3066\u9069\u7528\u3059\u308c\u3070\uff14\u3064\u306e\u4f4d\u7f6e\u3067\u56fa\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u3061\u306a\u307f\u306b\u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u306f\u53f3\u4e0b\u3067\u56fa\u5b9a\u3055\u308c\u307e\u3059\uff09<\/p>\n<h2>\u79fb\u52d5\u901f\u5ea6\uff08\u79d2\uff09\u3092\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u5192\u982d\u306b<code>jQuery<\/code>\u3067\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u3092\u5909\u66f4\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u4e2d\u3067\u306f1000\u30df\u30ea\u79d2\uff08\uff1d\uff11\u79d2\uff09\u3067\u79fb\u52d5\u3092\u5b8c\u4e86\u3059\u308b\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3057\u305f\u3002<\/p>\n<p>\u305b\u3063\u304b\u304f\u3067\u3059\u306e\u3067\u3001\u4eca\u56de\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u3082\u3053\u306e\u6a5f\u80fd\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>Vue.component('v-move-to-top', {\r\n    props: ['position', <strong>'duration'<\/strong>],\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    methods: {\r\n        moveToTop() {\r\n\r\n            <strong>const duration = parseInt(this.duration);<\/strong>\r\n            \r\n            \/\/ \u7701\u7565\r\n\r\n        }\r\n    },\r\n    \r\n    \/\/ \u7701\u7565\r\n\r\n});<\/pre>\n<p>\u3068\u3044\u3063\u3066\u3082\u3001\u307b\u307c\u30b3\u30fc\u30c9\u306f\u51fa\u6765\u4e0a\u304c\u3063\u3066\u3044\u308b\u306e\u3067<code>props<\/code>\u306b<code>duration<\/code>\u3092\u8ffd\u52a0\u3057\u3001<code>moveToTop()<\/code>\u306b\u9069\u7528\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001<code>parseInt()<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u306f<code>duration<\/code>\u306b\u306f\u6587\u5b57\u5217\u304c\u5165\u3063\u3066\u304f\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3067\u3059\u3002\u5b9f\u969b\u306b\u306f\u30a8\u30e9\u30fc\u306f\u767a\u751f\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u4eca\u5f8c\u306e\u62e1\u5f35\u306a\u3069\u3092\u898b\u636e\u3048\u3066\u3053\u3046\u3044\u3046\u90e8\u5206\u306f\u6b63\u78ba\u306b\u3057\u3066\u304a\u304f\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b \u3061\u306a\u307f\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>:<\/code>\u3092\u3064\u3051\u3066\u30c7\u30fc\u30bf\u3068\u3057\u3066\u6307\u5b9a\u3059\u308b\u3068\u6570\u5024\u3068\u3057\u3066\u6271\u3063\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre>&lt;v-move-to-top <strong>:duration=\"1000\"<\/strong>&gt;&lt;\/v-move-to-top&gt;<\/pre>\n<h2>\u8868\u793a\u3059\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u81ea\u7531\u306b\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u307b\u307c\u5b8c\u6210\u306b\u8fd1\u3065\u3044\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u3053\u3053\u3067\u3088\u308a\u6c4e\u7528\u7684\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u81ea\u7531\u306b\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>Vue.component('v-move-to-top', {\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n    template: '&lt;transition name=\"fade\"&gt;'+\r\n        '&lt;button type=\"button\" :style=\"styles\" v-if=\"show\" @click=\"moveToTop\"&gt;<strong>&lt;slot&gt;&lt;\/slot&gt;<\/strong>&lt;\/button&gt;'+\r\n        '&lt;\/transition&gt;',\r\n   \r\n    \/\/ \u7701\u7565\r\n\r\n});<\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3001\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u3092<code>&lt;slot&gt;&lt;\/slot&gt;<\/code>\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30bf\u30b0\u3067\u56f2\u3093\u3060\u90e8\u5206\u304c\u81ea\u52d5\u7684\u306b\u7f6e\u304d\u63db\u308f\u308b\u3088\u3046\u306b\u306a\u308b\u3001\u3064\u307e\u308a\u3001\u30dc\u30bf\u30f3\u306e\u30c6\u30ad\u30b9\u30c8\u304c\u6307\u5b9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3068\u3044\u3046\u8a33\u3067\u3059\u3002<\/p>\n<pre>&lt;v-move-to-top&gt;<strong>\u3053\u3053\u304c\u81ea\u7531\u306b\u5909\u66f4\u3067\u304d\u308b<\/strong>&lt;\/v-move-to-top&gt;<\/pre>\n<h2>CSS\u3092\u81ea\u7531\u306b\u8ffd\u52a0\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n<p>\u5b9f\u306f\u3001\u30b3\u30fc\u30c9\u7684\u306b\u306f\u3059\u3067\u306b\u5b8c\u6210\u3057\u3066\u3044\u3066\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u30bf\u30b0\u306b\u76f4\u63a5<code>CSS<\/code>\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066CSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e<code>Tailwind<\/code>\u3092\u4f7f\u3063\u3066\u30dc\u30bf\u30f3\u3092\u88c5\u98fe\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;head&gt;\r\n    <strong>&lt;link href=\"https:\/\/unpkg.com\/tailwindcss@^1.0\/dist\/tailwind.min.css\" rel=\"stylesheet\"&gt;<\/strong>\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;div id=\"app\"&gt;\r\n\r\n    &lt;v-move-to-top\r\n        position=\"bottom-right\"\r\n        duration=\"300\"\r\n        <strong>class=\"bg-gray-800 text-white font-bold p-2 px-4 rounded opacity-50\"<\/strong>&gt;\r\n        \u4e0a\u3078\r\n    &lt;\/v-move-to-top&gt;\r\n\r\n&lt;\/div&gt;\r\n\r\n&lt;!-- \u7701\u7565 --&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3053\u308c\u3067\u5b9f\u884c\u3057\u305f\u3082\u306e\u304c\u4ee5\u4e0b\u306e\u30dc\u30bf\u30f3\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4706\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/10\/vue_move_to_top_1.png\" alt=\"\" width=\"86\" height=\"62\" \/><\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4eca\u56de\u4f5c\u3063\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5b9f\u969b\u306b\u52d5\u304f\u304b\u3092\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u306a\u304a\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u306a\u3044\u3068\u30c1\u30a7\u30c3\u30af\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b100\u500b\u306e\u6539\u884c\u3092\u4f5c\u3063\u3066\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre>&lt;div id=\"app\"&gt;\r\n\r\n    &lt;!-- \u30c6\u30b9\u30c8\u7528\u306b\u6539\u884c100\u500b --&gt;\r\n    <strong>&lt;div v-for=\"i in 100\"&gt;<\/strong>\r\n<strong>        \u6539\u884c&lt;span v-text=\"i\"&gt;&lt;\/span&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n\r\n    &lt;v-move-to-top\r\n        position=\"bottom-right\"\r\n        duration=\"300\"\r\n        class=\"bg-gray-800 text-white font-bold p-2 px-4 rounded opacity-50\"&gt;\r\n        \u4e0a\u3078\r\n    &lt;\/v-move-to-top&gt;\r\n\r\n&lt;\/div&gt;<\/pre>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\uff01\uff08\u30dc\u30bf\u30f3\u306f\u30da\u30fc\u30b8\u53f3\u4e0b\u3067\u56fa\u5b9a\u3055\u308c\u307e\u3059\uff09<\/p>\n<p><iframe loading=\"lazy\" title=\"\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u3078\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\" width=\"525\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/ym1W4jU_odI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<h1>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u5b9f\u969b\u306b\u958b\u767a\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b <code>cdn<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u5c55\u958b\u3057\u3066\u3059\u3050\u8a66\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3088\uff01<\/p>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=4708&amp;tmstv=1777538047\" rel=\"nofollow\" id=\"download-link-4708\" data-redirect=\"false\" >\n\t\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u3078\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308bVue\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/a>\n\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f\u3001\u3042\u308c\u3070\u4fbf\u5229\u306a<code>Vue<\/code>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u3057\u3066\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u6a5f\u80fd\u3092\u958b\u767a\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u306f\u3001\u4eca\u56de\u306f\u3058\u3081\u3066<code>&lt;transition&gt;\u301c&lt;\/transition&gt;<\/code>\u3092\u4f7f\u3063\u305f\u306e\u3067\u3059\u304c\u30b7\u30f3\u30d7\u30eb\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u3066\u3061\u3087\u3063\u3068\u611f\u52d5\u3057\u307e\u3057\u305f\u3002\u3055\u3089\u306b\u3001\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u3060\u3051\u3058\u3083\u306a\u304f\u4ed6\u306b\u3082\u4f7f\u3044\u65b9\u304c\u3042\u308b\u3088\u3046\u306a\u306e\u3067\u3001<code>jQuery<\/code>\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u30b5\u30a4\u30c8\u3067\u306f\u91cd\u5b9d\u3059\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u307e\u305f\u3001\u666e\u6bb5\u306f<code>window.scrollTo()<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u4eca\u56de\u306f\u3042\u3048\u3066<code>window.scrollBy()<\/code>\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u305c\u304b\u3068\u3044\u3046\u3068\u3001\u5f53\u521d\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3053\u308c\u3060\u3068\u6bce\u56de\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u3092\u8a08\u7b97\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u304b\u3089\u304b<code>interval<\/code>\u304c\u77ed\u3044\u307b\u3069\u79fb\u52d5\u901f\u5ea6\u304c\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u304b\u3089\u3067\u3059\u3002<\/p>\n<pre>const duration = 3000;\r\nconst interval = 25;\r\nconst step = Math.ceil(window.scrollY \/ interval);\r\n\r\nconst timer = setInterval(() =&gt; {\r\n\r\n    window.scrollTo(0, <strong>window.scrollY-step<\/strong>);\r\n\r\n    if(window.scrollY &lt;= 0) {\r\n\r\n        clearInterval(timer);\r\n\r\n    }\r\n\r\n}, interval);<\/pre>\n<p>\u30a2\u30a4\u30c7\u30a2\u6b21\u7b2c\u3067\u89e3\u6c7a\u3067\u304d\u308b\u3053\u3068\u3082\u591a\u3044\u3060\u306a\u3068\u5b9f\u611f\u3057\u307e\u3057\u305f\ud83d\ude0a\u2728<\/p>\n<p>\u306a\u306b\u308f\u3068\u3082\u3042\u308c\u3001\u4eca\u56de\u306f\u3053\u306e\u3078\u3093\u3067\u7d42\u4e86\u3067\u3059\u3002<br \/>\n\u305c\u3072\u7686\u3055\u3093\u3082\u300c\u3042\u308b\u3068\u4fbf\u5229\u304b\u3082\u300d\u3092\u63a2\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u306f\u6642\u30fb\u5206\u304c\u9023\u643a\u3059\u308b\u6642\u9593\u5165\u529b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u30e6\u30fc\u30b6\u30d3\u30ea\u30c6\u30a3\u304c\u30c6\u30fc\u30de\u306e\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u3082\u305d\u306e\u6d41\u308c\u3067\u300c\u3042\u308c\u3070\u5730\u5473\u306b\u4fbf\u5229\u300d\u3068\u3044\u3046\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=4705\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Vue\u3060\u3051\u3067\u3064\u304f\u308b\uff01\u30da\u30fc\u30b8\u30c8\u30c3\u30d7\u3078\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08DL\u53ef\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":4713,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[178],"class_list":["post-4705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vue-js","tag-178"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4705"}],"version-history":[{"count":2,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4705\/revisions"}],"predecessor-version":[{"id":4712,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/4705\/revisions\/4712"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/4713"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}