jquery-ui.js를 지금까지 animate에서 색깔도 바꿀수 있게 쓰려고 사용했던 나 자신을 굉장히 반성합니다 OTL
jquer-ui.css도 있다는걸 오늘 알았다. 빠가사리.
jquery-ui로 할수 있는게 굉장히 많은데, 일단 cdn주소부터 살펴보면 이렇다.
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
유용하게 쓸수있을것 같은 effect를 살펴보자. 물론 http://jqueryui.com/
여기서 데모까지 볼수 있다.
1. Draggable 선택자를 드래그 할수 있게 하려면
<script>
$( function() {
$( "선택자" ).draggable();
} );
</script>
물론 여러가지 옵션이 있으므로 잘 보고 사용하면 된다 :)
2. Resizable 크기를 줄이고 늘릴수 있게 하려면
$( function() {
$( "선택자" ).resizable();
} );
maximun / minimum size도 정할수 있고, 하나의 요소를 resize할때 다른 요소도 같이 resize되게 묶을수도 있으며, textarea에도 적용 가능하다.
3. Selectable tab메뉴 사용시 유용할것 같은것!
먼저 css에서
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
select됬을때 어떻게 바뀔지 정해준다음,
<ol id="selectable">
<li class="ui-widget-content">Item 1</li>
<li class="ui-widget-content">Item 2</li>
<li class="ui-widget-content">Item 3</li>
<li class="ui-widget-content">Item 4</li>
<li class="ui-widget-content">Item 5</li>
<li class="ui-widget-content">Item 6</li>
<li class="ui-widget-content">Item 7</li>
</ol>
이렇게 class를 ui-widget-content 를 주고,
<script>
$( function() {
$( "#selectable" ).selectable();
} );
</script>
이렇게 적용하면 된다 ^__^
3. Accordion - collapse 닫을수 있는 아코디언
먼저 전체를 감싸는 div에 id="accordion"을 주고,
<h3></h3>안에 하나의 아코디언의 제목을 쓴다음 그 뒤에 따라오는 div에 해당 아코디언의 내용을 쓴다. 이런식으로 반복하면 된다.
4. 가장 신기했던 Datepicker
<p>Date: <input type="text" id="datepicker"></p>
이렇게 input에 id="datepicker"를 주고나서
<script>
$( function() {
$( "#datepicker" ).datepicker();
} );
</script>
이것만 써주면 된당 . 개신기. 아이콘으로 선택할수도 있다
5. 조오오오옹오오오올라 간단한 구글맵 추가
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Spinner - Map</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="/resources/demos/external/jquery-mousewheel/jquery.mousewheel.js"></script>
<script>
$( function() {
function latlong() {
return new google.maps.LatLng( $("#lat").val(), $("#lng").val() );
}
function position() {
map.setCenter( latlong() );
}
$( "#lat, #lng" ).spinner({
step: .001,
change: position,
stop: position
});
var map = new google.maps.Map( $("#map")[0], {
zoom: 8,
center: latlong(),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
} );
</script>
<style>
#map {
width:500px;
height:500px;
}
</style>
</head>
<body>
<label for="lat">Latitude</label>
<input id="lat" name="lat" value="44.797">
<br>
<label for="lng">Longitude</label>
<input id="lng" name="lng" value="-93.278">
<div id="map"></div>
</body>
|
cs |
이렇게 간단하게 input으로 좌표를 주고 googlemap을 로드시킬수 있다.
6. tooltip 마우스 오버시 나타나는거
<p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes."></p>
이렇게 title속성으로 주고나서,
<script>
$( function() {
$( document ).tooltip();
} );
</script>
이렇게만 해주면 된당 ^___^
'퍼블리싱 > HTML | CSS | Javascript' 카테고리의 다른 글
background animate (0) | 2017.04.04 |
---|---|
jquery-ui 2 (0) | 2017.04.02 |
click이벤트에 여러 효과 동시에 주기 :p 초간단! (0) | 2017.04.02 |
select box를 제이쿼리로 외형제어 (0) | 2017.04.02 |
(링크) 마우스를 돋보기 처럼 쓰는 플러그인 (0) | 2017.04.02 |