{"id":382,"date":"2018-03-27T20:05:59","date_gmt":"2018-03-27T11:05:59","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=382"},"modified":"2018-03-27T20:05:59","modified_gmt":"2018-03-27T11:05:59","slug":"jquery-slim%e7%89%88%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ab%e3%80%81%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96js%e3%81%a7%e5%8b%95%e3%81%8f%e8%87%aa%e5%8b%95%e3%82%b9%e3%82%af%e3%83%ad%e3%83%bc","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=382","title":{"rendered":"jquery.slim\u7248\u306e\u305f\u3081\u306b\u3001\u30cd\u30a4\u30c6\u30a3\u30d6JS\u3067\u52d5\u304f\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3092\u4f5c\u3063\u3066\u307f\u305f"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u73fe\u5728\u306fReactJS\u306a\u3069\u306e\u51fa\u73fe\u306b\u3088\u3063\u3066\u5c11\u3057\u4eba\u6c17\u3092\u843d\u3068\u3057\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308b<strong>jQuery<\/strong>\u3067\u3059\u304c\u3001\u958b\u767a\u306f\u7d99\u7d9a\u4e2d\u3067\u73fe\u5728\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306f3.3.1\uff082018\/03\/27\u73fe\u5728\uff09\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3082\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\uff13.0\u304b\u3089\u306f<strong>\u5fc5\u8981\u6700\u4f4e\u9650\u306e\u6a5f\u80fd\u3060\u3051\u3092\u4f7f\u3048\u308bjquery.slim\u30d0\u30fc\u30b8\u30e7\u30f3<\/strong>\u3082\u516c\u958b\u3055\u308c\u3066\u3044\u3066\u3001SEO\u306b\u91cd\u8981\u3068\u8a00\u308f\u308c\u308b\u8868\u793a\u901f\u5ea6\u306e\u9ad8\u901f\u5316\u306b\u6709\u52b9\u306a\u624b\u6bb5\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3053\u306eslim\u30d0\u30fc\u30b8\u30e7\u30f3\u3002\u4f55\u304c\u9055\u3046\u304b\u3068\u3044\u3046\u3068\u3001\u901a\u5e38\u7248\u306b\u3042\u308b\u4ee5\u4e0b\uff12\u3064\u304c\u4f7f\u3048\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>ajax\u3000\u30fb\u30fb\u30fb\u3000\u305d\u306e\u307e\u307eajax\u901a\u4fe1<\/strong><\/li>\n<li><strong>effects\u3000\u30fb\u30fb\u30fb\u3000\u79fb\u52d5\u3068\u304b\u900f\u660e\u3068\u304b\u306e\u30a8\u30d5\u30a7\u30af\u30c8<\/strong><\/li>\n<\/ul>\n<p>\u6b63\u76f4\u306a\u3068\u3053\u308d\u3001\u73fe\u5728\u79c1\u306e\u958b\u767a\u3067\u306f\u30e1\u30a4\u30f3JS\u306f\u300cvue\u300d\u306b\u7f6e\u304d\u63db\u308f\u3063\u3066\u3057\u307e\u3063\u3066\u307e\u3059\u3057\u3001ajax\u306f\u300caxios\u300d\u306a\u306e\u3067\u3001\u3082\u3046jquery\u81ea\u4f53\u3092\u4f7f\u308f\u306a\u3044\u65b9\u5411\u306b\u5411\u304b\u3063\u3066\u306f\u3044\u307e\u3059\u3002\u3060\u3051\u3069\u3001\u3084\u3063\u3071\u308abootstrap\uff08jquery\u5fc5\u9808\uff09\u304c\u4f7f\u3044\u305f\u3044\u5834\u9762\u304c\u591a\u3044\u306e\u3067\u3001\u305b\u3081\u3066jquery.slim\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u7f6e\u304d\u63db\u3048\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>bootstrap\uff08ver 4.0\uff09\u3067\u3084\u3063\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u5b09\u3057\u3044\u3053\u3068\u306bnavbar\u3084collapse\u306a\u3069\u306fjquery.slim\u3067\u52d5\u304f\u3088\u3046\u3067\u3057\u305f\u304c\u3001\u4e00\u70b9\u3060\u3051\u3069\u3046\u3057\u3066\u3082\u4f7f\u3044\u305f\u3044\u6a5f\u80fd\u3092\u5931\u3063\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u304c\u3064\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">$.animate();<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u4ed6\u306e\u30b5\u30a4\u30c8\u3067\u3082\u3088\u304f\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b<strong>\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u81ea\u52d5\u3067\u4e00\u756a\u4e0a\u307e\u3067\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u304f\u308c\u308b\u30dc\u30bf\u30f3<\/strong>\u306a\u3069\u306b\u5229\u7528\u3055\u308c\u3066\u308b\u4fbf\u5229\u306a\u95a2\u6570\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-384\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/03\/Screenshot-from-2018-03-27-19-43-44.png\" alt=\"\" width=\"89\" height=\"63\" \/><\/p>\n<p>\u3067\u3082\u3001\u3053\u308c\u306f\u300c<strong>effects<\/strong>\u300d\u306e\u6a5f\u80fd\u306a\u306e\u3067slim\u7248\u306b\u306f\u5165\u3063\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u306e\u90e8\u5206\u3060\u3051\u306f\u306a\u3093\u3068\u304b\u30cd\u30a4\u30c6\u30a3\u30d6JavaScript\u3067\u5b9f\u88c5\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306f\u3001vue.js\u7248\u3067\u3059\u3051\u3069\u3001moveToTop()\u3092\u629c\u304d\u51fa\u305b\u3070\u3069\u3093\u306a\u74b0\u5883\u3067\u3082\u52d5\u304f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u203b\u3061\u306a\u307f\u306b\u30a2\u30ed\u30fc\u95a2\u6570\u3092\u4f7f\u3063\u3066\u308b\u306e\u3067IE\u3068\u304b\u306f\u5fae\u5999\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002function\u3092\u4f7f\u3046\u3053\u3068\u3082\u8003\u3048\u307e\u3057\u305f\u3051\u3069\u3001\u958b\u767a\u8005\u3068\u3057\u3066\u306f\u3001\u3053\u3046\u3084\u3063\u3066\u4e00\u523b\u3082\u65e9\u304fIE\u3092\u99c6\u9010\u3057\u305f\u3044\u3093\u3067\u3059\uff08\u7b11\uff09<\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;head&gt;\r\n    &lt;link href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/4.0.0\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\r\n&lt;\/head&gt;\r\n&lt;div id=\"app\"&gt;\r\n    &lt;div v-for=\"i in 100\" v-text=\"i\"&gt;&lt;\/div&gt;\r\n    &lt;button style=\"position:fixed;right:15px;bottom:15px;\" class=\"btn btn-primary\" @click=\"moveToTop(500)\"&gt;\u4e0a\u3078&lt;\/button&gt;\r\n&lt;\/div&gt;\r\n&lt;script src=\"https:\/\/code.jquery.com\/jquery-3.3.1.slim.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/unpkg.com\/vue@2.5.16\/dist\/vue.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\n\r\n    new Vue({\r\n        el: '#app',\r\n        methods: {\r\n            <strong>moveToTop(duration) {<\/strong>\r\n<strong>                let interval = 10;<\/strong>\r\n<strong>                let scrollX = window.scrollX;<\/strong>\r\n<strong>                let scrollY = window.scrollY;<\/strong>\r\n<strong>                let step = Math.ceil(scrollY \/ (duration \/ interval));<\/strong>\r\n<strong>                let timer = setInterval(() =&gt; {<\/strong>\r\n\r\n<strong>                    if(window.scrollY &gt; 0) {<\/strong>\r\n\r\n<strong>                        scrollY -= step;<\/strong>\r\n<strong>                        window.scrollTo(scrollX, scrollY);<\/strong>\r\n\r\n<strong>                    } else {<\/strong>\r\n\r\n<strong>                        clearInterval(timer);<\/strong>\r\n\r\n<strong>                    }<\/strong>\r\n\r\n<strong>                }, interval);<\/strong>\r\n<strong>            }<\/strong>\r\n        }\r\n    });\r\n\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u95a2\u6570\u7248\u306f\u3053\u3061\u3089\u3002<\/p>\n<pre><strong>moveToTop(duration) {<\/strong>\r\n<strong>    let interval = 10;<\/strong>\r\n<strong>    let scrollX = window.scrollX;<\/strong>\r\n<strong>    let scrollY = window.scrollY;<\/strong>\r\n<strong>    let step = Math.ceil(scrollY \/ (duration \/ interval));<\/strong>\r\n<strong>    let timer = setInterval(() =&gt; {<\/strong>\r\n\r\n<strong>        if(window.scrollY &gt; 0) {<\/strong>\r\n\r\n<strong>            scrollY -= step;<\/strong>\r\n<strong>            window.scrollTo(scrollX, scrollY);<\/strong>\r\n\r\n<strong>        } else {<\/strong>\r\n\r\n<strong>            clearInterval(timer);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    }, interval);<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3042\u3068\u3001\u3082\u3057\u3082\u3063\u3068\u8ca0\u8377\u3092\u8efd\u6e1b\u3057\u305f\u3044\u5834\u5408\u306f\u3001interval\u306e\u30df\u30ea\u79d2\u3092\u5897\u3084\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002\u3069\u308c\u307b\u3069\u52b9\u679c\u304c\u3042\u308b\u304b\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u3051\u3069\u591a\u5c11\u306f\u30de\u30b7\u306b\u306a\u308b\u304b\u3082\u3067\u3059\u3002<\/p>\n<h1>\u7d42\u308f\u308a\u306b<\/h1>\n<p>bootstrap\u3092vue\u306b\u79fb\u690d\u3057\u305f<a href=\"https:\/\/bootstrap-vue.js.org\/\">Bootstrap + Vue<\/a>\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u3042\u308b\u3093\u3067\u3059\u3051\u3069\u3001\u3067\u304d\u308c\u3070\u672c\u5bb6\u3067\u3082\u3084\u3063\u3066\u307b\u3057\u3044\u3067\u3059\u306d\u3002\u3067\u3082\u3084\u308b\u3068\u3057\u3066\u3082\u3001ReactJS\u304bangular\u304c\u5148\u306a\u306e\u304b\u306a\u3002<\/p>\n<p>\u3053\u308c\u304b\u3089\u3082\u3082\u3063\u3068vueJS\u306e\u4eba\u6c17\u304c\u4e0a\u304c\u3063\u3066\u304f\u308c\u308b\u3053\u3068\u3092\u671f\u5f85\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u73fe\u5728\u306fReactJS\u306a\u3069\u306e\u51fa\u73fe\u306b\u3088\u3063\u3066\u5c11\u3057\u4eba\u6c17\u3092\u843d\u3068\u3057\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308bjQuery\u3067\u3059\u304c\u3001\u958b\u767a\u306f\u7d99\u7d9a\u4e2d\u3067\u73fe\u5728\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306f3.3.1\uff082018\/0 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=382\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;jquery.slim\u7248\u306e\u305f\u3081\u306b\u3001\u30cd\u30a4\u30c6\u30a3\u30d6JS\u3067\u52d5\u304f\u81ea\u52d5\u30b9\u30af\u30ed\u30fc\u30eb\u3092\u4f5c\u3063\u3066\u307f\u305f&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":385,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12],"tags":[55],"class_list":["post-382","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-vue-js","tag-bootstrap"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/382","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=382"}],"version-history":[{"count":2,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/382\/revisions"}],"predecessor-version":[{"id":386,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/382\/revisions\/386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/385"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}