{"id":11838,"date":"2022-01-07T12:50:08","date_gmt":"2022-01-07T03:50:08","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=11838"},"modified":"2022-01-12T08:11:05","modified_gmt":"2022-01-11T23:11:05","slug":"gwc-ui-library-switch","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=11838","title":{"rendered":"#GWC UI Library : Switch"},"content":{"rendered":"<p>\uc6f9 UI \ub77c\uc774\ube0c\ub7ec\ub9ac\uc778 GWC\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 Switch \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \ub300\ud55c \uc608\uc81c \ucf54\ub4dc\uc785\ub2c8\ub2e4.<\/p>\n<p>\uba3c\uc800 DOM \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">\r\n<div class=\"center\">\r\n    <div>\r\n        <gwc-switch id=\"switch1\"><\/gwc-switch>\r\n        <gwc-switch id=\"switch2\" label=\"GWC \ub77c\uc774\ube0c\ub7ec\ub9ac\" disabled=true><\/gwc-switch>\r\n    <\/div>\r\n    <div>\r\n        <gwc-button id=\"button1\" title=\"\uc0c1\ud0dc \ud655\uc778\"><\/gwc-button>\r\n        <gwc-button id=\"button2\" title=\"ON\/OFF \ud1a0\uae00\"><\/gwc-button>\r\n        <gwc-button id=\"button3\" title=\"\ube44\ud65c\uc131\ud654 \ud1a0\uae00\"><\/gwc-button>\r\n    <\/div>\r\n<\/div>\r\n<\/pre>\n<p>\uadf8\ub9ac\uace0 CSS \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uad6c\uc694.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">\r\n.center {\r\n    display: flex;\r\n    width: 100%;\r\n    height: 100%;\r\n    justify-content: center;\r\n    align-items: center;\r\n    flex-direction: column;\r\n    gap: 3em;\r\n}\r\n\r\n#switch1 {\r\n    margin-right: 5em;\r\n}\r\n<\/pre>\n<p>js \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\">\r\nwindow.onload = () => {\r\n    const switch1 = document.querySelector(\"#switch1\");\r\n    switch1.addEventListener(\"change\", (event) => {\r\n        if(event.target.on) {\r\n            switch1.label = \"\ub9d1\uc740 \ub0a0~\";\r\n        } else {\r\n            switch1.label = \"\ube44\uac00 \uc624\ub098\uc694?\";\r\n        }\r\n    });\r\n\r\n    const switch2 = document.querySelector(\"#switch2\");\r\n\r\n    document.querySelector(\"#button1\").addEventListener(\"click\", () => {\r\n        alert(`switch1: ${switch1.on} \/ switch2: ${switch2.on}`);\r\n    });\r\n\r\n    document.querySelector(\"#button2\").addEventListener(\"click\", () => {\r\n        switch1.on = !switch1.on;\r\n    });\r\n\r\n    document.querySelector(\"#button3\").addEventListener(\"click\", () => {\r\n        switch2.disabled =  !switch2.disabled;\r\n    });\r\n};\r\n<\/pre>\n<p>\uc2e4\ud589 \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><center><video controls=\"controls\" ><source src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2022\/01\/gwc-switch.mp4\" \/>\ube44\ub514\uc624\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \uc6f9\ube0c\ub77c\uc6b0\uc838\uc785\ub2c8\ub2e4.<\/video><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc6f9 UI \ub77c\uc774\ube0c\ub7ec\ub9ac\uc778 GWC\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 Switch \ucef4\ud3ec\ub10c\ud2b8\uc5d0 \ub300\ud55c \uc608\uc81c \ucf54\ub4dc\uc785\ub2c8\ub2e4. \uba3c\uc800 DOM \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. \uadf8\ub9ac\uace0 CSS \uad6c\uc131\uc740 \ub2e4\uc74c\uacfc \uac19\uad6c\uc694. .center { display: flex; width: 100%; height: 100%; justify-content: center; align-items: center; flex-direction: column; gap: 3em; } #switch1 { margin-right: 5em; } js \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. window.onload = () => { const switch1 = document.querySelector(&#8220;#switch1&#8221;); &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=11838\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;#GWC UI Library : Switch&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[140,1],"tags":[],"class_list":["post-11838","post","type-post","status-publish","format-standard","hentry","category-gwc","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11838"}],"version-history":[{"count":3,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11838\/revisions"}],"predecessor-version":[{"id":11916,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/11838\/revisions\/11916"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11838"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}