{"id":4253,"date":"2024-01-19T13:23:39","date_gmt":"2024-01-19T04:23:39","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=4253"},"modified":"2024-01-18T13:36:25","modified_gmt":"2024-01-18T04:36:25","slug":"post-4253","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/4253","title":{"rendered":"jQuery\u306eanimate()\u3067\u30da\u30fc\u30b8\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306b\u4ed6\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>jQuery\u306eanimate()\u3067\u30da\u30fc\u30b8\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306b\u7279\u5b9a\u306e\u8981\u7d20\u3092\u975e\u8868\u793a\u306b\u3057\u305f\u3044\u3068\u3044\u3046\u30b1\u30fc\u30b9\u304c\u3042\u3063\u305f\u3002\u300canimate()\u2192$('xxx').hide()\u300d\u306e\u3088\u3046\u306b\u66f8\u304f\u3068\u307b\u307c\u540c\u6642\u306b\u5b9f\u884c\u3055\u308c\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u7121\u3044\u307e\u307e\u306b\u8981\u7d20\u304c\u6d88\u3048\u308b\u3068\u3044\u3046\u898b\u305f\u76ee\u306b\u306a\u308b\u3002\u305d\u306e\u305f\u3081animate()\u304c\u5b8c\u4e86\u3057\u305f\u5f8c\u306b\u5225\u306e\u51e6\u7406\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u5bfe\u5fdc\u65b9\u6cd5<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$('elem').animate({\u51e6\u7406\u5185\u5bb9}, 400, function(){\r\n    animate()\u5b8c\u4e86\u5f8c\u306b\u884c\u3046\u51e6\u7406\u5185\u5bb9\r\n});<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067animate()\u5b8c\u4e86\u5f8c\u306b\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\u3002\u8a73\u7d30\u306f<a href=\"https:\/\/js.studio-kingdom.com\/jquery\/effects\/animate\" target=\"_blank\" rel=\"noopener\">\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u53c2\u7167\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"https:\/\/taitan916.info\/sample\/animate\/\" target=\"_blank\" rel=\"noopener\">https:\/\/taitan916.info\/sample\/animate\/<\/a><\/p>\n<p>\u30da\u30fc\u30b8\u4e0b\u90e8\u306b\u30dc\u30bf\u30f3\u304c\u3042\u308a\u30af\u30ea\u30c3\u30af\u3059\u308b\u3053\u3068\u3067\u3001\u305d\u308c\u305e\u308c\u7570\u306a\u308b\u52d5\u4f5c\u304c\u78ba\u8a8d\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;html lang=\"ja\"&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\r\n&lt;title&gt;jQuery\u306eanimate\u306e\u30c6\u30b9\u30c8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body id=\"top\"&gt;\r\n    &lt;div style=\"background-color: #f00; height: 500px\"&gt;&lt;\/div&gt;\r\n    &lt;div style=\"background-color: #0f0; height: 500px\"&gt;&lt;\/div&gt;\r\n    &lt;div style=\"background-color: #00f; height: 500px\"&gt;&lt;\/div&gt;\r\n    &lt;input id=\"type-1\" type=\"button\" value=\"\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u540c\u6642\u306bdiv\u8981\u7d20\u524a\u9664\"&gt;\r\n    &lt;input id=\"type-2\" type=\"button\" value=\"\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306bdiv\u8981\u7d20\u524a\u9664\"&gt;\r\n    &lt;input id=\"type-3\" type=\"button\" value=\"\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306bdiv\u8981\u7d20\u3092\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\"&gt;\r\n    &lt;script type=\"text\/javascript\" src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n    $(function(){\r\n        $('#type-1').on('click', function(){\r\n            $('html,body').animate({scrollTop:$(`#top`).offset().top}, 400);\r\n            $(`div`).hide();\r\n        });\r\n        $('#type-2').on('click', function(){\r\n            $('html,body').animate({scrollTop:$(`#top`).offset().top}, 400, function(){\r\n                $(`div`).hide();\r\n            });\r\n        });\r\n        $('#type-3').on('click', function(){\r\n            $('html,body').animate({scrollTop:$(`#top`).offset().top}, 400, function(){\r\n                $(`div`).fadeOut('slow');\r\n            });\r\n        });\r\n    });\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<h3>\u89e3\u8aac<\/h3>\n<p>\u300c$('#type-1')\u300d\u306e\u51e6\u7406\u306f\u7279\u306b\u4f55\u3082\u8003\u3048\u305a\u306b\u66f8\u3044\u305f\u30d1\u30bf\u30fc\u30f3\u3002\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u975e\u8868\u793a\u51e6\u7406\u304c(\u898b\u305f\u76ee\u4e0a\u3067\u306f)\u307b\u307c\u540c\u6642\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u300c$('#type-2')\u300d\u306fanimate()\u3067\u306e\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u5b8c\u4e86\u5f8c\u306bhide()\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002\u3053\u3061\u3089\u3067\u3082\u60aa\u304f\u306a\u3044\u3093\u3060\u3051\u3069\u30b9\u30af\u30ed\u30fc\u30eb\u5b8c\u4e86\u76f4\u5f8c\u306bhide()\u304c\u5b9f\u884c\u3055\u308c\u308b\u305f\u3081\u3001\u4e00\u77ac\u30da\u30fc\u30b8\u306e\u8868\u793a\u304c\u4e71\u308c\u308b\u3088\u3046\u306a\u611f\u3058\u3092\u53d7\u3051\u305f\u3002<\/p>\n<p>\u300c$('#type-3')\u300d\u306fanimate()\u3067\u306e\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u5b8c\u4e86\u5f8c\u306bfadeOut()\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002hide()\u3067\u4e00\u77ac\u3067\u8981\u7d20\u3092\u6d88\u3059\u3088\u308a\u3082\u6ed1\u3089\u304b\u306a\u611f\u3058\u3092\u53d7\u3051\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery\u306eanimate()\u3067\u30da\u30fc\u30b8\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306b\u7279\u5b9a\u306e\u8981\u7d20\u3092\u975e\u8868\u793a\u306b\u3057\u305f\u3044 ... <\/p>\n","protected":false},"author":1,"featured_media":1071,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-4253","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","category-javascript"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/4253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=4253"}],"version-history":[{"count":0,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/4253\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1071"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=4253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=4253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=4253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}