Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 텍스트조절
- TweenMax.js
- github
- 웹표준
- CSS
- JSP
- jQuery
- 팝업레이어
- sqld
- 프론트앤드키워드
- 마우스커서
- JS
- sqld52회차
- SQL
- 코딩공부
- 웹접근성
- asp
- 로또 회차
- VANILLA
- 웹개발키워드
- 애니메이션
- SQLD후기
- IP차단
- 바닐라 자바스크립트
- 기초
- Slide
- git
- 바닐라스크립트
- Python
- 바닐라자바스크립트
Archives
- Today
- Total
단비의 코딩 공부 blog
[jquery]버튼 클릭 시 텍스트 크기 조절 본문
html
<div id="switcher" class="clear_fix">
<div class="button" id="switcher-large">-</div>
<div class="txt_label">텍스트 크기</div>
<div class="button" id="switcher-small">+</div>
</div>
jquery
$(document).ready(function() {
$("div.button").click(function() {
var $text_wrap = $("div.text_wrap");
var currentSize = $text_wrap.css("fontSize");
//alert(currentSize);
var num = parseFloat(currentSize, 10);
var unit = currentSize.slice(-2);
if(this.id == "switcher-small"){
num *= 1.2;
} else if(this.id == "switcher-large") {
num /= 1.2;
}
$text_wrap.css("fontSize", num + unit);
});
});
'javascript&jquery' 카테고리의 다른 글
[Vanilla JS]study 8일차 - BOM (1) | 2023.01.27 |
---|---|
[Vanilla JS]study 7일차 - 기본내장객체 로또생성하기 (0) | 2023.01.11 |
[Vanilla JS]study 6일차 - 객체와 기본내장객체 (0) | 2022.12.09 |
[javascript]날짜 지정 event (로또 회차) (0) | 2022.12.07 |
[Vanilla JS]study 5일차 - 함수 (0) | 2022.12.07 |