비밀글 체크박스를 토글 버튼으로 바꾸고싶어요..

비밀글 체크박스를 토글 버튼으로 바꾸고싶어요..

QA

비밀글 체크박스를 토글 버튼으로 바꾸고싶어요..

본문

나리야 사용중인데요...

 

글쓰기에서 비밀글 체크박스를 토글버튼 (o   ) on  //  (  o) off  요런거

https://proto.io/freebies/onoff/

ios13 스타일로 적용하고 싶은데

 

어떻게 적용해야 할까요 ㅠㅠ?

 

그리고 온/오프 시 비밀번호 작성 칸을 보이고 안보이게 같이 연동하고싶은데..;; 가능할까요?

이 질문에 댓글 쓰기 :

답변 2


<style>
 
.onoffswitch {
    position: relative; width: 66px;
    -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.onoffswitch-label {
    display: block; overflow: hidden; cursor: pointer;
    border: 2px solid #999999; border-radius: 20px;
}
.onoffswitch-inner {
    display: block; width: 200%; margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
    display: block; float: left; width: 50%; height: 20px; padding: 0; line-height: 20px;
    font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
    box-sizing: border-box;
}
.onoffswitch-inner:before {
    content: "ON";
    padding-left: 10px;
    background-color: #34A7C1; color: #FFFFFF;
}
.onoffswitch-inner:after {
    content: "OFF";
    padding-right: 10px;
    background-color: #EEEEEE; color: #999999;
    text-align: right;
}
.onoffswitch-switch {
    display: block; width: 18px; margin: 1px;
    background: #FFFFFF;
    position: absolute; top: 0; bottom: 0;
    right: 42px;
    border: 2px solid #999999; border-radius: 20px;
    transition: all 0.3s ease-in 0s; 
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px; 
}
</style>
<script>
<div class="onoffswitch">
    <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" tabindex="0" checked>
    <label class="onoffswitch-label" for="myonoffswitch">
        <span class="onoffswitch-inner"></span>
        <span class="onoffswitch-switch"></span>
    </label>
</div>
</script>

위에 적어주신 사이트에 소스가 있네요  이대로 원하시는 부분에 붙혀넣으면 원하시는효과 나오실거에요 .

name="onoffswitch"  <- 이부분만 기존 값으로 바꿔서 테스트 해보셔요.

답변을 작성하시기 전에 로그인 해주세요.
전체 119
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT