2016년 8월 31일 수요일

08day JQuery UI

1
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
     #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //drag & drop
        $( "#draggable" ).draggable();
        $( "#droppable" ).droppable({
          drop: function( event, ui ) {
            $( this )
              .addClass( "ui-state-highlight" )
              .find( "p" )
                .html( "Dropped!" );
          }
        });
    });
</script>
</head>
<body>

<div id="draggable" class="ui-widget-content">
  <p>Drag me to my target</p>
</div>
 
<div id="droppable" class="ui-widget-header">
  <p>Drop here</p>
</div>

</body>
</html>


2
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #sortable1, #sortable2 {
        border: 1px solid #eee;
        width: 142px;
        min-height: 20px;
        list-style-type: none;
        margin: 0;
        padding: 5px 0 0 0;
        float: left;
        margin-right: 10px;
    }
    #sortable1 li, #sortable2 li {
      margin: 0 5px 5px 5px;
      padding: 5px;
      font-size: 1.2em;
      width: 120px;
    }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //sortable  
        $( "#sortable1, #sortable2" ).sortable({
              connectWith: ".connectedSortable" //정렬 가능한 다른 ul 태그 지정
            }).disableSelection();
    });
</script>
</head>
<body>

<ul id="sortable1" class="connectedSortable">
  <li class="ui-state-default">Item 1</li>
  <li class="ui-state-default">Item 2</li>
  <li class="ui-state-default">Item 3</li>
  <li class="ui-state-default">Item 4</li>
  <li class="ui-state-default">Item 5</li>
</ul>
 
<ul id="sortable2" class="connectedSortable">
  <li class="ui-state-highlight">Item 1</li>
  <li class="ui-state-highlight">Item 2</li>
  <li class="ui-state-highlight">Item 3</li>
  <li class="ui-state-highlight">Item 4</li>
  <li class="ui-state-highlight">Item 5</li>
</ul>
 

</body>
</html>


3
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #feedback { font-size: 1.4em; }
    #selectable .ui-selecting { background: #FECA40; }
    #selectable .ui-selected { background: #F39814; color: white; }
    #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
    #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //selectable
        $( "#selectable" ).selectable({
            stop: function(){
                var result = $('#select-result').empty();
                //선택된것과 지금 선택한것의 인덱스를 받아와서 출력
                $('.ui-selected', this).each(function(){
                    var index = $('#selectable li').index(this);
                    result.append(" #"+(index +1));
                });
            }
        });
    });
</script>
</head>
<body>

<p id="feedback">
<span>You've selected:</span> <span id="select-result">none</span>.
</p>

<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>
</ol>

</body>
</html>


4
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #resizable { width: 150px; height: 150px; padding: 0.5em; }
    #resizable h3 { text-align: center; margin: 0; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //resizable 블락의 크기를 조절 가능하게
        $('#resizable').resizable({
            grid: 50  //크기의 증가 단위를 지정
        });
    });
</script>
</head>
<body>

<div id="resizable" class="ui-widget-content">
  <h3 class="ui-widget-header">Grid</h3>
</div>

</body>
</html>


5
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body { font-size: 70%; }
    h1 { padding: .2em; margin: 0; }
    #products { float:left; width: 500px; margin-right: 2em; }
    #cart { width: 200px; float: left; margin-top: 1em; }
    #cart ol { margin: 0; padding: 1em 0 1em 3em; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        //아코디언
        $('#catalog').accordion();
        //드래거블
        $('#catalog li').draggable({
            appendTo: 'body', //드래그 가능영역
            helper: 'clone'
        });
        //드롭퍼블
        $('#cart ol').droppable({
            activeClass: 'ui-state-default',
            hoverClass: 'ui-state-hover',
            accept: ':not(.ui-sortable-helper)',
            //드롭시 이벤트
            drop: function(event,ui){
                $(this).find('.placeholder').remove();  //기존에 적혀있던 안내말 삭제
                
                //쇼핑카트에있는 것을 다시 드롭 했을경우 카운트를 1씩 올리기
                var mcount=0;
                //쇼핑카트에 리스트를 하나씩 불러와서 드래그 한 것과 비교
                $(this).find('li').each(function(index,item){
                    if($(item).text().split('(')[0]==ui.draggable.text()){
                        var num = parseInt($(item).text().split('(')[1].split(')')[0]);
                        num++;
                        $(item).text(ui.draggable.text()+"("+num+")");
                        mcount++;
                    }
                })
                //쇼핑카트에없으면 그냥 드롭
                if(mcount==0){
                    $('<li></li>').text(ui.draggable.text()+"(1)").appendTo(this);
                }
            }
        }).sortable({
            items: 'li:not(.placeholder)',
            sort: function(){
                $(this).removeClass('ui-state-default');
            }
        });
    });
</script>
</head>
<body>

<div id="products">
     <h1 class="ui-widget-header">Products</h1>
     <div id="catalog">
          <h2><a href="#">T-Shirts</a></h2>
          <div>
               <ul>
                    <li>Lolcat Shirt</li>
                    <li>Cheezeburger Shirt</li>
                    <li>Buckit Shirt</li>
               </ul>
          </div>
          <h2><a href="#">Bags</a></h2>
          <div>
               <ul>
                    <li>Zebra Striped</li>
                    <li>Black Leather</li>
                    <li>Alligator Leather</li>
               </ul>
          </div>
          <h2><a href="#">Gadgets</a></h2>
          <div>
               <ul>
                    <li>iPhone</li>
                    <li>iPod</li>
                    <li>iPad</li>
               </ul>
          </div>
     </div>
</div>

<div id="cart">
     <h1 class="ui-widget-header">Shopping Cart</h1>
     <div class="ui-widget-content">
          <ol>
               <li class="placeholder">Add your items here</li>
          </ol>
     </div>
</div>

</body>
</html>


6
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    * { margin: 0px; padding: 0px;}
    body { font-size: 62.5%}
    .item>img {width: 100px; height:100px}
    #wrap { overflow: hidden;}
    #wrap > div {float:left;}
    #dock{ position:fixed; min-height: 120px; width:100%; bottom: 0px; z-index: 1;}
    #dock>div{float: right;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        for(var i=0; i<21; i++){
            var icon ='';
            icon += '<div class="ui-widget-content ui-corner-all item">';
            icon += '<img src = "./cart/'+i+'.png">';
            icon += '</div>';
            $('#wrap').append(icon);    
        }
        
        $('#wrap > div').draggable({
            helper: 'clone',
            zIndex: 100,
            scroll: false
        });
        
        $('#dock').droppable({
            accept: '#wrap > div',
            drop: function(event,ui){
                $(ui.draggable).appendTo('#dock').fadeIn();
            }
        });
        $('body').droppable({
            accept: '#dock > div',
            drop: function(event,ui){
                $(ui.draggable).fadeOut(function(){
                    $(this).appendTo('#wrap').fadeIn();
                });
            }
        });
    });
</script>
</head>
<body>

<div id="wrap"></div>
<div id="dock" class="ui-state-error"></div>

</body>
</html>


7jQuery colorBox
예제 파일 다운
http://www.jacklmoore.com/colorbox/
https://github.com/jackmoore/colorbox


실습폴더 구성

8
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/colorbox.css">
<script type="text/javascript" src="./js/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="./js/jquery.colorbox.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //colorbox
        $('a[rel="Lightbox"]').colorbox({
            width:500,
            height: 400,
            slideshow: true,     //자동 페이지 넘김
            transition: 'fade',  //페이지 이동시 효과
            speed: 500,         //페이지 이동 속도
            opacity: 0.5,        //배경색 투명도
            
            onOpen: function(){    alert('실행');},  //시작시 이벤트
            onClosed: function(){ alert('종료');}   //종료시 이벤트
        });
    });

</script>
</head>
<body>
<!-- rel로 그룹화 시키면 같은 그룹의 사진간 이동가능 -->
<a rel="Lightbox" title="제목1" href="./images/Desert.jpg">image1</a>
<a rel="Lightbox" title="제목2" href="./images/Tulips.jpg">image2</a>
<a rel="Lightbox" title="제목3" href="./images/Chrysanthemum.jpg">image3</a>
<a rel="Lightbox" title="제목4" href="./images/Hydrangeas.jpg">image4</a>
<a rel="Lightbox" title="제목5" href="./images/Jellyfish.jpg">image5</a>
<a rel="Lightbox" title="제목6" href="./images/Koala.jpg">image6</a>
<a rel="Lightbox" title="제목7" href="./images/Lighthouse.jpg">image7</a>
<a rel="Lightbox" title="제목8" href="./images/Penguins.jpg">image8</a>

</body>
</html>


9
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/colorbox.css">
<script type="text/javascript" src="./js/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="./js/jquery.colorbox.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //colorbox 글짜 출력
        $('a').colorbox({
            inline: true, //href 안으로 타고 들어감
            width: 600,
            height: 400
        })
    });

</script>
</head>
<body>

<a href="#dialog">내용 보이기</a>

<div id="#dialogs" style="display: none">
    <div id="dialog">
        <p>박진호/사회자:</p>
        <p>사회적 재앙이었던 가습기 살균제 사건. 첫 사망자가 나온 지 5년 만에 결국 국회에서 청문회가 열렸습니다.</p>
        <p>그런데요. 이 책임이 있는 영국 본사 쪽 책임자는 한 명도 나오지 않은 청문회여서 비난이 일었고요. 청문회 위원장이시죠.</p>
    </div>
</div>

</body>
</html>


10.W2UI
w2ui
http://w2ui.com/web/demo/layout


예제파일 다운받기
https://github.com/vitmalina/w2ui


예제파일 실행

11.W2UI
실습 폴더 구성


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/w2ui-1.4.3.css">
<style>
    #wrap { margin: 0 auto; width: 690px; height: 500px;}
</style>
<!-- 그리드는 jQuery 3버전에서 에러남  (현재2016.08.31) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="./js/w2ui-1.4.3.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //그리드
        var data=[  //데이터를 밖에서 선언해도 됨
                      {recid:1, name:"책1", author:"홍길동", publisher:"프리렉", price: 30000, point:10},
                      {recid:2, name:"책2", author:"성춘향", publisher:"프리렉", price: 20000, point:10}
                  ];
        
        $('#wrap').w2grid({
            name: 'grid',
            columns: [
                        {field: 'recid', caption: 'ID', size: '10%'},
                        {field: 'name', caption: '도서명', size: '50%'},
                        {field: 'author', caption: '저자', size: '20%'},
                        {field: 'publisher', caption: '출판사', size: '30%'},
                        {field: 'price', caption: '가격', size: '20%'},
                        {field: 'point', caption: '판매지수', size: '20%'},
                      ],
            records: data
        });
    });

</script>
</head>
<body>

<div id="wrap"></div>

</body>
</html>


12
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/w2ui-1.4.3.css">
<style>
    #wrap { margin: 0 auto; width: 690px; height: 500px;}
</style>
<!-- 그리드는 jQuery 3버전에서 에러남  (현재2016.08.31) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="./js/w2ui-1.4.3.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //그리드
        $('#wrap').w2grid({
            name: 'grid',
            show: {
                header: true,  //제목보이게
                toolbar: true,  //툴바 보이게
                footer: true
            },
            //열 정의
            columns: [
                        {field: 'recid', caption: 'ID', size: '10%'},
                        {field: 'name', caption: '도서명', size: '50%'},
                        {field: 'author', caption: '저자', size: '20%'},
                        {field: 'publisher', caption: '출판사', size: '30%'},
                        {field: 'price', caption: '가격', size: '20%'},
                        {field: 'point', caption: '판매지수', size: '20%'},
                      ],
            //데이터
            records: [  
                          {recid:1, name:"책1", author:"홍길동", publisher:"프리렉", price: 30000, point:10},
                          {recid:2, name:"책2", author:"성춘향", publisher:"프리렉", price: 20000, point:10},
                          {recid:3, name:"책3", author:"Mike", publisher:"프리렉", price: 30000, point:10}
                      ],
            
            //이벤트
            onReload: function(target,eventData){  //툴바 새로고침
                var grid = this;
                //내용지움
                grid.clear();
                //내용채움
                grid.add({recid:3, name:"책3", author:"Mike", publisher:"프리렉", price: 30000, point:10});
                grid.add({recid:4, name:"책4", author:"Tom", publisher:"프리렉", price: 30000, point:10});
                //총 데이터 갯수
                alert(grid.total);
                eventData.preventDefault();
            },
            onSearch: function(target,eventData){  //툴바 검색시
                alert('onSearch');
                eventData.preventDefault();
            }
        });
    });

</script>
</head>
<body>

<div id="wrap"></div>

</body>
</html>


2016년 8월 30일 화요일

07day JQuery UI

1
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #accordion-resizer {
    padding: 10px;
    width: 350px;
    height: 220px;
  }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //아코디언
        $( "#accordion" ).accordion({
            heightStyle: "fill"  //부모태그의 크기에 맞춤 //'content' 내용크기에 맞춤
        });
        //크기를 드래그해서 조정할 수있음
        $( "#accordion-resizer" ).resizable({
              minHeight: 140,
              minWidth: 200,
              //크기조절 이벤트시 아코디언 새로고침
              resize: function() {
                $( "#accordion" ).accordion( "refresh" );
              }
            });
    });
</script>
</head>
<body>
<div id="accordion-resizer" class="ui-widget-content">
    <div id="accordion">
      <h3>Section 1</h3>
      <div>
        <p>
        Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
        amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
        odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
        </p>
      </div>
      <h3>Section 2</h3>
      <div>
        <p>
        Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
        purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
        velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
        suscipit faucibus urna.
        </p>
      </div>
      <h3>Section 3</h3>
      <div>
        <p>
        Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
        Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
        ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
        lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
        </p>
        <ul>
          <li>List item one</li>
          <li>List item two</li>
          <li>List item three</li>
        </ul>
      </div>
      <h3>Section 4</h3>
      <div>
        <p>
        Cras dictum. Pellentesque habitant morbi tristique senectus et netus
        et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
        faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
        mauris vel est.
        </p>
        <p>
        Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
        Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
        inceptos himenaeos.
        </p>
      </div>
    </div>
</div>

</body>
</html>


2
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //아코디언
        $( "#accordion" ).accordion();
        //아코디언 목록 추가
        $('#btn1').on('click',function(){
            var data = '<h3>Section add</h3>';
                  data += '<div>';
                  data +=  $('div div').html();
                  data += '</div>';
            $('#accordion').append(data);  //목록추가
            $('#accordion').accordion("refresh");  //새로고침
        });
    });
</script>
</head>
<body>

<button id="btn1">데이터 추가</button>
<hr>

<div id="accordion">
  <h3>Section 1</h3>
  <div>
    <p>
    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
    </p>
  </div>
  <h3>Section 2</h3>
  <div>
    <p>
    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
    suscipit faucibus urna.
    </p>
  </div>
  <h3>Section 3</h3>
  <div>
    <p>
    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
    Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
    ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
    lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
    </p>
    <ul>
      <li>List item one</li>
      <li>List item two</li>
      <li>List item three</li>
    </ul>
  </div>
  <h3>Section 4</h3>
  <div>
    <p>
    Cras dictum. Pellentesque habitant morbi tristique senectus et netus
    et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
    faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
    mauris vel est.
    </p>
    <p>
    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
    Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
    inceptos himenaeos.
    </p>
  </div>
</div>

</body>
</html>


3
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //스피너
        $( "#spinner" ).spinner({
            min: 5,
            max: 10,
            step: 2,
            spin: function(evnet,ui){
                console.log(ui.value);
            }
        });
        //값 설정
        $('#btn').on('click',function(){
            $('#spinner').spinner('value',7);
        });
        
    });
</script>
</head>
<body>
<button id="btn">set value to 7</button>
<br><hr>
<p>
  <label for="spinner">Amount to donate:</label>
  <input id="spinner" name="spinner" value="5">
</p>

</body>
</html>


4
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #map {
    width:500px;
    height:500px;
     }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<!-- 구글 지도 자바스크립트 라이브러리 가져옴 -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?key=#########구글개인키###########&sensor=false"></script>
<script type="text/javascript">
    $(document).ready(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
        });
        //지도객체를 스피너에서 조절 할 수있도록 if문 밖으로 꺼내 놓음
        var map = new google.maps.Map( $("#map")[0],{});    
        
        if(navigator.geolocation){
           //현재위치 가져오기
            navigator.geolocation.getCurrentPosition(function(position){
                 $("#lat").val(position.coords.latitude);
                  $("#lng").val(position.coords.longitude);
                  
                 //구글지도 생성
                   map = new google.maps.Map( $("#map")[0], {
                     zoom: 16,
                     center: latlong(),
                     mapTypeId: google.maps.MapTypeId.ROADMAP
                   });
                 
                   //위치 표시
                   new google.maps.Marker({
                   position: latlong(),
                   map: map
                   });    
            });
        }else{
            result.innerHTML = 'Geolocation 미지원';
        }

    });
</script>
</head>
<body>

<label for="lat">Latitude</label>
<input id="lat" name="lat">
<br>
<label for="lng">Longitude</label>
<input id="lng" name="lng">
 
<div id="map"></div>

</body>
</html>


5
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //날짜선택기
        $('#datepicker').datepicker();
        $('#datepicker').datepicker("option", "dateFormat", "yy-mm-dd");  //형식 지정
        //효과 선택
        $('#anim').on('change',function(){
            $('#datepicker').datepicker('option','showAnim', $( this ).val() )
        });
        //날짜 선택기를 고정
        $('#datepicker2').datepicker({
            numberOfMonths: 3, //달력 3개
            showButtonPanel: true,
            dateFormat: 'yy-mm-dd'
        });
        
    });
</script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>
<p>Animations:<br>
  <select id="anim">
    <option value="show">Show (default)</option>
    <option value="slideDown">Slide down</option>
    <option value="fadeIn">Fade in</option>
    <option value="blind">Blind (UI Effect)</option>
    <option value="bounce">Bounce (UI Effect)</option>
    <option value="clip">Clip (UI Effect)</option>
    <option value="drop">Drop (UI Effect)</option>
    <option value="fold">Fold (UI Effect)</option>
    <option value="slide">Slide (UI Effect)</option>
    <option value="">None</option>
  </select>
</p>
<div id="datepicker2"></div>
</body>
</html>


6
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //다이얼로그
        $('#dialog').dialog({
            autoOpen:false,
            modal: true, //뒷창 클릭 못함
            height:300,
            resizable:false, //창 크기 조절 못하게
            position: { my: "left top", at: "left bottom", of: '#btn1' }, //다이얼 위치
            show:{      //열릴때 이벤트
                effect: "blind",
                duration: 500
            },
            buttons: {     //버튼 생성
                '확인': function(){
                    alert('확인했습니다');
                    $(this).dialog("close");
                },
                '취소': function(){
                    alert('취소했습니다');
                    $(this).dialog("close");
                }
            }
        });
        //버튼 클릭시 다이얼로그 뜨도록
        $('#btn1').button().on('click',function(){
            $('#dialog').dialog('open');
        });
    });
</script>
</head>
<body>

<button id="btn1">Dialog 열기</button>
<hr>
<div id="dialog" title="Title">
    <h1>Hello Dialog</h1>
</div>


</body>
</html>


7
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    label, input { display:block; }
    input.text { margin-bottom:12px; width:95%; padding: .4em; }
    fieldset { padding:0; border:0; margin-top:25px; }
    h1 { font-size: 1.2em; margin: .6em 0; }
    div#users-contain { width: 350px; margin: 20px 0; }
    div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
    div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
    .ui-dialog .ui-state-error { padding: .3em; }
    .validateTips { border: 1px solid transparent; padding: 0.3em; }    
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //회원가입 다이얼로그
        $('#dialog-form').dialog({
            autoOpen:false,
            height: 300,
            width: 350,
            modal: true,
            //버튼 클릭시 기존 회원테이블에 추가
            buttons: {
                "Create an account": function(){
                    var result ='';
                    result +='<tr>';
                    result +='<td>'+$('#name').val()+'</td>';
                    result +='<td>'+$('#email').val()+'</td>'; 
                    result +='<td>'+$('#password').val()+'</td>';
                    result +='</tr>';
                    $('tbody').append(result);
                    //닫기
                    $(this).dialog('close');
                },
                Cancel: function() { dialog.dialog( "close" );}
            }
        });
        //버튼클릭시 오픈
        $('#create-user').button().on('click',function(){
            $('#dialog-form').dialog('open');
        });
        
    });
</script>
</head>
<body>
<div id="dialog-form" title="Create new user">
  <p class="validateTips">All form fields are required.</p>
 
  <form>
    <fieldset>
      <label for="name">Name</label>
      <input type="text" name="name" id="name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
      <label for="email">Email</label>
      <input type="text" name="email" id="email" value="jane@smith.com" class="text ui-widget-content ui-corner-all">
      <label for="password">Password</label>
      <input type="password" name="password" id="password" value="xxxxxxx" class="text ui-widget-content ui-corner-all">
 
      <!-- Allow form submission with keyboard without duplicating the dialog button -->
      <input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
    </fieldset>
  </form>
</div>
 
 
<div id="users-contain" class="ui-widget">
  <h1>Existing Users:</h1>
  <table id="users" class="ui-widget ui-widget-content">
    <thead>
      <tr class="ui-widget-header ">
        <th>Name</th>
        <th>Email</th>
        <th>Password</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John Doe</td>
        <td>john.doe@example.com</td>
        <td>johndoe1</td>
      </tr>
    </tbody>
  </table>
</div>
<button id="create-user">Create new user</button>

</body>
</html>


8
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    label, input { display:block; }
    input.text { margin-bottom:12px; width:95%; padding: .4em; }
    fieldset { padding:0; border:0; margin-top:25px; }
    h1 { font-size: 1.2em; margin: .6em 0; }
    div#users-contain { width: 350px; margin: 20px 0; }
    div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
    div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
    .ui-dialog .ui-state-error { padding: .3em; }
    .validateTips { border: 1px solid transparent; padding: 0.3em; }    
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //회원가입 다이얼로그 초기값
        $('#dialog-form').dialog({
            autoOpen:false,  //처음에 다이얼로그 안보이게
            height: 300,
            width: 350,
            modal: true
        });
        
        //유저 생성 버튼
        $('#create-user').button().on('click',function(){
            $('.ui-dialog-title').html('Create new user');
            $('#dialog-form').dialog({
                autoOpen:true,
                //버튼 클릭시 기존 회원테이블에 추가
                buttons: {
                    "Create an account": function(){
                        var result ='';
                        result +='<tr>';
                        result +='<td>'+$('#name').val()+'</td>';
                        result +='<td>'+$('#email').val()+'</td>'; 
                        result +='<td>'+$('#password').val()+'</td>';
                        result +='<td><button class="modify-user">modify</button></td>';
                        result +='</tr>';
                        $('tbody').append(result);
                        //창 닫기
                        $(this).dialog('close');
                        //데이터 수정 버튼 --새로 만들어진 버튼에 적용
                        $('.modify-user').button().on('click',function(){
                            //클릭한 버튼과 동일한 행에 위치한 <td> 태그들을 정의
                            var name = $(this).parents('td').siblings().eq(0);
                            var email = $(this).parents('td').siblings().eq(1);
                            var password = $(this).parents('td').siblings().eq(2);
                            //유저테이블에 적힌 값을 가져와 다이얼로그에 넣음
                            $('#name').val(name.html());
                            $('#email').val(email.html());
                            $('#password').val('');
                            //수정용 다이얼로그 띄움
                            $('.ui-dialog-title').html('Modify user');
                            $('#dialog-form').dialog({
                                autoOpen:true,
                                //버튼 클릭시 수정
                                buttons: {
                                    "Update an account": function(){
                                        //다이얼로그 값을 위에 정의한 테이블 태그<td>안에 넣음
                                        name.html($('#name').val());
                                        email.html($('#email').val());
                                        password.html($('#password').val());
                                        //닫기
                                        $(this).dialog('close');
                                    },
                                    Cancel: function() { dialog.dialog( "close" );}
                                }
                            });
                        });
                    },
                    Cancel: function() { dialog.dialog( "close" );}
                }
            });
        });
        
        //데이터 수정 버튼 --기존에 있던 행에 적용
        $('.modify-user').button().on('click',function(){
            var name = $(this).parents('td').siblings().eq(0);
            var email = $(this).parents('td').siblings().eq(1);
            var password = $(this).parents('td').siblings().eq(2);
            $('#name').val(name.html());
            $('#email').val(email.html());
            $('#password').val('');
            
            $('.ui-dialog-title').html('Modify user');
            $('#dialog-form').dialog({
                autoOpen:true,
                //버튼 클릭시 수정
                buttons: {
                    "Update an account": function(){
                        name.html($('#name').val());
                        email.html($('#email').val());
                        password.html($('#password').val());
                        //닫기
                        $(this).dialog('close');
                    },
                    Cancel: function() { dialog.dialog( "close" );}
                }
            });
        });
        
    });
</script>
</head>
<body>
<div id="dialog-form" title="Create new user">
  <p class="validateTips">All form fields are required.</p>
 
  <form>
    <fieldset>
      <label for="name">Name</label>
      <input type="text" name="name" id="name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
      <label for="email">Email</label>
      <input type="text" name="email" id="email" value="jane@smith.com" class="text ui-widget-content ui-corner-all">
      <label for="password">Password</label>
      <input type="password" name="password" id="password" value="xxxxxxx" class="text ui-widget-content ui-corner-all">
 
      <!-- Allow form submission with keyboard without duplicating the dialog button -->
      <input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
    </fieldset>
  </form>
</div>
 
 
<div id="users-contain" class="ui-widget">
  <h1>Existing Users:</h1>
  <table id="users" class="ui-widget ui-widget-content">
    <thead>
      <tr class="ui-widget-header ">
        <th>Name</th>
        <th>Email</th>
        <th>Password</th>
        <th>수정</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John Doe</td>
        <td>john.doe@example.com</td>
        <td>johndoe1</td>
        <td><button class="modify-user">modify</button></td>
      </tr>
    </tbody>
  </table>
</div>
<button id="create-user">Create new user</button>

</body>
</html>


9
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    .ui-menu { width: 150px; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //메뉴바
        $('#menu').menu();
    });
</script>
</head>
<body>

<ul id="menu">
  <li class="ui-state-disabled"><div>Toys (n/a)</div></li><!-- 선택 해제 -->
  <li><div><span class="ui-icon ui-icon-zoomin"></span>Books</div></li><!-- 아이콘 넣기 -->
  <li><div>Clothing</div></li>
  <li><div>Electronics</div>
    <ul>
      <li class="ui-state-disabled"><div>Home Entertainment</div></li>
      <li><div>Car Hifi</div></li>
      <li><div>Utilities</div></li>
    </ul>
  </li>
  <li><div>Movies</div></li>
  <li><div>Music</div>
    <ul>
      <li><div>Rock</div>
        <ul>
          <li><div>Alternative</div></li>
          <li><div>Classic</div></li>
        </ul>
      </li>
      <li><div>Jazz</div>
        <ul>
          <li><div>Freejazz</div></li>
          <li><div>Big Band</div></li>
          <li><div>Modern</div></li>
        </ul>
      </li>
      <li><div>Pop</div></li>
    </ul>
  </li>
  <li class="ui-state-disabled"><div>Specials (n/a)</div></li>
</ul>

</body>
</html>


10
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //tab
        $('#tabs').tabs({
            event:"mouseover"
        });
    });
</script>
</head>
<body>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
  </ul>
  <div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
  </div>
  <div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
  </div>
  <div id="tabs-3">
    <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
    <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
  </div>
</div>

</body>
</html>


11
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    #dialog label, #dialog input { display:block; }
    #dialog label { margin-top: 0.5em; }
    #dialog input, #dialog textarea { width: 95%; }
    #tabs { margin-top: 1em; }
    #tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; }
    #add_tab { cursor: pointer; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //탭 삭제 생성
        var tabTitle = $( "#tab_title" ),
          tabContent = $( "#tab_content" ),
          // # escape해줘야함
          tabTemplate = "<li><a href='\#{href}'>\#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>",
          tabCounter = 2;
     
        var tabs = $( "#tabs" ).tabs();
     
        // Modal dialog init: custom buttons and a "close" callback resetting the form inside
        var dialog = $( "#dialog" ).dialog({
          autoOpen: false,
          modal: true,
          buttons: {
            Add: function() {
              addTab();
              $( this ).dialog( "close" );
            },
            Cancel: function() {
              $( this ).dialog( "close" );
            }
          },
          close: function() {
            form[ 0 ].reset();
          }
        });
     
        // AddTab form: calls addTab function on submit and closes the dialog
        var form = dialog.find( "form" ).on( "submit", function( event ) {
          addTab();
          dialog.dialog( "close" );
          event.preventDefault();
        });
     
        // Actual addTab function: adds new tab using the input from the form above
        function addTab() {
          var label = tabTitle.val() || "Tab " + tabCounter,
            id = "tabs-" + tabCounter,
            li = $( tabTemplate.replace( /#\{href\}/g, "#" + id ).replace( /#\{label\}/g, label ) ),
            tabContentHtml = tabContent.val() || "Tab " + tabCounter + " content.";
     
          tabs.find( ".ui-tabs-nav" ).append( li );
          tabs.append( "<div id='" + id + "'><p>" + tabContentHtml + "</p></div>" );
          tabs.tabs( "refresh" );
          tabCounter++;
        }
     
        // AddTab button: just opens the dialog
        $( "#add_tab" )
          .button()
          .on( "click", function() {
            dialog.dialog( "open" );
          });
     
        // Close icon: removing the tab on click
        tabs.on( "click", "span.ui-icon-close", function() {
          var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
          $( "#" + panelId ).remove();
          tabs.tabs( "refresh" );
        });
     
        tabs.on( "keyup", function( event ) {
          if ( event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE ) {
            var panelId = tabs.find( ".ui-tabs-active" ).remove().attr( "aria-controls" );
            $( "#" + panelId ).remove();
            tabs.tabs( "refresh" );
          }
        });
    });
</script>
</head>
<body>

<div id="dialog" title="Tab data">
  <form>
    <fieldset class="ui-helper-reset">
      <label for="tab_title">Title</label>
      <input type="text" name="tab_title" id="tab_title" value="Tab Title" class="ui-widget-content ui-corner-all">
      <label for="tab_content">Content</label>
      <textarea name="tab_content" id="tab_content" class="ui-widget-content ui-corner-all">Tab content</textarea>
    </fieldset>
  </form>
</div>
 
<button id="add_tab">Add Tab</button>
 
<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close" role="presentation">Remove Tab</span></li>
  </ul>
  <div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
  </div>
</div>

</body>
</html>


12
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //tooltip 도움말 띄우기 
        $( document ).tooltip();
    });
</script>
</head>
<body>

<p><a href="#" title="That&apos;s what this widget is">Tooltips</a> can be attached to any element. When you hover
the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.</p>
<p>But as it's not a native tooltip, it can be styled. Any themes built with
<a href="http://jqueryui.com/themeroller/" title="ThemeRoller: jQuery UI&apos;s theme builder application">ThemeRoller</a>
will also style tooltips accordingly.</p>
<p>Tooltips are also useful for form elements, to show some additional information in the context of each field.</p>
<p><label for="age">Your age:</label><input id="age" title="We ask for your age only for statistical purposes."></p>
<p>Hover the field to see the tooltip.</p>

</body>
</html>


2016년 8월 29일 월요일

06day JQuery UI

javascipt

  • library : 추가기능
  • framework : 추가 + 확장 문법
    • JQuery
    • ext.js
    • angular
    • ...
  • plug-in : 프레임워크상에서 확장되어 개발됨
    • JQuery UI
    • Bootstrap
    • ....

 jQuery UI 모든 소스 다운받기
압축파일 해제후 복사 붙여넣기
모든 소스가 공개되어있음

다운
테마 다운



1
설정, 폴더구성





2
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- 테마 적용 폴더명만 바꾸면 다르게 적용됨 -->
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<link rel="stylesheet" href="./css/cupertino/jquery-ui.css" />
<style type="text/css">
    /* jQuery UI가 영어기반이라서 한글사이즈를 조금 줄임 */
    body {font-size : 80%;}
</style>
<!-- jQuery 적용 -->
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<!-- jQuery UI 적용 -->
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('a').button();
    });
</script>
</head>
<body>
<a href="#">난 버튼</a>
</body>
</html>


3
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- 테마 적용 폴더명만 바꾸면 다르게 적용됨 -->
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<!-- jQuery 적용 -->
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<!-- jQuery UI 적용 -->
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //버튼 jQuery UI 적용
        $('#btn1').button();
        $('input').button();
        $('a').button();
        $('#btn2').button();
    });
</script>
</head>
<body>

<button id="btn1">버튼 1</button><br>
<input type="submit" value="버튼 2" /><br>
<a href="#">버튼 3</a><br>
<div id="btn2">버튼 4</div><br>
</body>
</html>


4
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- 테마 적용 폴더명만 바꾸면 다르게 적용됨 -->
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<!-- jQuery 적용 -->
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<!-- jQuery UI 적용 -->
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //버튼 아이콘 넣기
        $('#btn1').button({});
        $('#btn2').button({
            icons: {primary: 'ui-icon-locked'},
            text: false
        });
        
        //버튼 아이콘 위치
        $(function(){
            $(".widget button")
            .eq(0).button()
            .end().eq(1).button({
                icon: "ui-icon-gear",
                showLabel:false
            }).end().eq(2).button({
                icon:"ui-icon-gear",
            }).end().eq(3).button({
                icon:"ui-icon-gear",
                iconPosition:"end"
            }).end().eq(4).button({
                icon:"ui-icon-gear",
                iconPosition:"top"
            }).end().eq(5).button({
                icon: "ui-icon-gear",
                iconPosition: "bottom"
            });
        });
        
    });
</script>
</head>
<body>

<button id="btn1">버튼 1</button>
<button id="btn2">버튼 1</button>

<div class="widget">
  <h1>Widget</h1>
  <button>Button with only text</button>
  <button>Button with icon only</button>
  <button>Button with icon on the left</button>
  <button>Button with icon on the right</button>
  <button>Button with icon on the top</button>
  <button>Button with icon on the bottom</button>
</div>
</body>
</html>


아이콘 이름 보기 http://jqueryui.com/themeroller/

5
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //checkboxradio
        $('input').checkboxradio({
            icon: false //체크상자 지움
        });
    });
</script>
</head>
<body>

<fieldset>
    <legend>Hotel Ratings : </legend>
    <label for="cb-1">2 Star</label>
    <input type="checkbox" name="cb1" id="cb-1" />
    <label for="cb-2">3 Star</label>
    <input type="checkbox" name="cb2" id="cb-2" />
    <label for="cb-3">4 Star</label>
    <input type="checkbox" name="cb3" id="cb-3" />
    <label for="cb-4">5 Star</label>
    <input type="checkbox" name="cb4" id="cb-4" />
</fieldset>
</body>
</html>


6
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //radio
        $('input').checkboxradio();
    });
</script>
</head>
<body>

<fieldset>
    <legend>Select a Location : </legend>
    <label for="r-1">New York</label>
    <input type="radio" name="r1" id="r-1" />
    <label for="r-2">Paris</label>
    <input type="radio" name="r1" id="r-2" />
    <label for="r-3">London</label>
    <input type="radio" name="r1" id="r-3" />
</fieldset>
</body>
</html>


7
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    .shape {
      margin-left: 4em;
      margin-top: 2.5em;
      height: 8em;
      width: 8em;
      box-shadow: 4px 4px 8px;
      color: #ccc;
      background-repeat: no-repeat;
      background-size: 90%;
      background-position: 50%;
    }
    .circle, .pill {
      border-radius: 8em;
    }
    .pill, .rectangle {
      width: 16em;
    }
    .square, .circle {
      margin-left: 9em;
    }
    .border {
      border: 2px solid #333333;
    }
    .toggles {
      width: 200px;
    }
    .toggle-wrap, .shape {
      display: inline-block;
      vertical-align: top;
    }
    .controls {
      background: #ccc;
      padding: 1em;
      display: inline-block;
    }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(function(){
        //버튼 이벤트 함수 선언
        function handleShape(e){
            $('.shape').removeClass("circle pill square rectangle").addClass($(e.target).val());
        };
        function handleToggle(e){
            var target = $(e.target);
            if(target.is(".brand-toggle")){
                var checked = target.is(":checked"),
                value = $("[name='brand']").filter(":checked").attr("data-"+target[0].id)
                $(".shape").css(target[0].id, checked? value: "");
            }else{
                $(".shape").toggleClass(target[0].id, target.is(":checked"));
            }
        }
        function updateBrand(){
            handleShape({ target: $("[name='shape']:checked")});
            $(".toggle:checked").each(function(){
                handleToggle({target: $(this)});
            });
        }
        
        //jQuery UI 위젯
        $( "input" ).checkboxradio();
        $( ".shape-bar, .brand" ).controlgroup();
        $( ".toggles" ).controlgroup( {
          direction: "vertical"
        } );
     
        // 이벤트
        $( "[name='brand']").on( "change", updateBrand );
        $( "[name='shape']").on( "change", handleShape );
        $( ".toggle" ).on( "change", handleToggle );
     
        // 초기값 설정
        updateBrand();
    });
</script>
</head>
<body>

<div class="controls">
  <div class="brand-wrap">
    <h3>1.) Select a brand</h3>
    <div class="brand">
      <label for="brand-jquery">jQuery</label>
      <input type="radio" name="brand" id="brand-jquery" data-background-color="#0769AD" data-color="#7ACEF4" data-background-image="url(images/jquery.png)">
      <label for="brand-jquery-ui">jQuery UI</label>
      <input type="radio" name="brand" id="brand-jquery-ui" data-background-color="#B24926" data-color="#FAA523" data-background-image="url(images/jquery-ui.png)" checked>
      <label for="brand-jquery-mobile">jQuery Mobile</label>
      <input type="radio" name="brand" id="brand-jquery-mobile" data-background-color="#108040" data-color="#3EB249" data-background-image="url(images/jquery-mobile.png)">
      <label for="brand-sizzle">Sizzle</label>
      <input type="radio" name="brand" id="brand-sizzle" data-background-color="#9A1B1E" data-color="#FAA523" data-background-image="url(images/sizzle.png)">
      <label for="brand-qunit">QUnit</label>
      <input type="radio" name="brand" id="brand-qunit" data-background-color="#390F39" data-color="#9C3493" data-background-image="url(images/qunit.png)">
    </div>
  </div>
  <div class="shape-wrap">
    <h3>2.) Select a shape</h3>
    <div class="shape-bar">
      <label for="shape-circle">Circle</label>
      <input type="radio" name="shape" id="shape-circle" value="circle" checked>
      <label for="shape-square">Square</label>
      <input type="radio" name="shape" id="shape-square" value="square">
      <label for="shape-pill">Pill</label>
      <input type="radio" name="shape" id="shape-pill" value="pill">
      <label for="shape-rectangle">Rectangle</label>
      <input type="radio" name="shape" id="shape-rectangle" value="rectangle">
    </div>
  </div>
  <div class="toggle-wrap">
    <h3>3.) Customize</h3>
    <div class="toggles">
      <label for="color">Shadow</label>
      <input class="toggle brand-toggle" type="checkbox" name="color" id="color">
      <label for="border">Border</label>
      <input class="toggle" type="checkbox" name="border" id="border">
      <label for="background-color">Background</label>
      <input class="toggle brand-toggle" type="checkbox" name="background-color" id="background-color" checked>
      <label for="background-image">Background Image</label>
      <input class="toggle brand-toggle" type="checkbox" name="background-image" id="background-image" checked>
    </div>
  </div>
  <div class="shape circle background jquery-ui"></div>
</div>

</body>
</html>


8
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //진행막대
        var data = 50;
        $('#progressbar').progressbar({
            value: data
        });
        //감소
        $('#btn1').button().on('click',function(){
            data -=5;
            $('#progressbar').progressbar({value:data});
        });
        //증가
        $('#btn2').button().on('click',function(){
            data +=5;
            $('#progressbar').progressbar({value:data});
        });
    });
</script>
</head>
<body>

<div>
    <div id="progressbar"></div>
    <hr>
    <button id="btn1">감소</button>
    <button id="btn2">증가</button>
</div>

</body>
</html>


9
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    .ui-progressbar { position: relative;}
    .progress-label {
        position : absolute;
        left: 50%;
        top: 4px;
        font-weight: bold;
        text-shadow 1px 1px 0 #ffffff;
    }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        var progressbar = $('#progressbar');
        var progressLabel = $('.progress-label');
        
        progressbar.progressbar({
            value: false,
            //이벤트 : 값의 변화 생길때 퍼센트 표시
            change: function(){
                progressLabel.text(progressbar.progressbar('value')+'%');
            },
            //100% 되었을 때
            complete: function(){
                progressLabel.text('완료');
            }
        });
        
        //진행막대 증가
        function progress(){
            var val = progressbar.progressbar('value') || 0;  //값을 받지 못하면 0으로 지정
            progressbar.progressbar('value', val+2);
            if(val<99){
                setTimeout(progress, 80);
            }
        }
        
        setTimeout(progress,2000);
    });
</script>
</head>
<body>


<div id="progressbar">
    <div class="progress-label">Loding ...</div>
</div>


</body>
</html>


10
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //slider
        $('#slider').slider({
            orientation: 'horizontal',
            min: 0,
            max: 255,
            value: 50, //시작값
            //step: 20,  //증가량
            change: function(){            //클릭시 변화
                console.log($(this).slider('value'));
            },
            slide: function(){            //드레그시 변화
                console.log($(this).slider('value'));
            }
        });
    });
</script>
</head>
<body>

<div id="slider"></div>

</body>
</html>


11
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //멀티 slider
        $('#slider').slider({
            range: true,
            min: 0,
            max: 255,
            values: [10,90],
            //슬라이드 값 가져오기
            change : function(event,ui){
                console.log(ui.values[0] + ' / ' + ui.values[1]);
                console.log($(this).slider('values',0) + ' / ' + $(this).slider('values',1)); //위와 동일한 결과
            }
        });
    });
</script>
</head>
<body>

<div id="slider"></div>

</body>
</html>


12
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //Selectmenu
        $('#speed').selectmenu();
    });
</script>
</head>
<body>

<div>
    <select id="speed">
        <option>Slower</option>
        <option>Sloow</option>
        <option selected="selected">Medium</option>
        <option>Fast</option>
        <option>Faster</option>
    </select>
</div>

</body>
</html>


13
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    fieldset {border :0; margin-left:300px;}
    label {display: block; margin:20px 0 0;}
    #circle {
        float:left;
        background: yellow;
        border-radius: 50%;
        width: 150px;
        height: 150px;
    }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //Selectmenu
        var circle = $('#circle');
        $('#radius').selectmenu({
            width: 300,
            //반지름 조절
            change: function(event, ui){
                circle.css({
                    width: ui.item.value,
                    height: ui.item.value
                });
            }
        });
        $('#color').selectmenu({
            width: 300,
            //색깔 조절
            change: function(event, ui){
                circle.css({
                    background: ui.item.value
                });
            }
        });
    });
</script>
</head>
<body>

<div>
    <div id="circle"></div>
    <fieldset>
        <label for="radius">Circle radius</label>
        <select name="radius" id="radius">
            <option value="50">50px</option>
            <option value="100">100px</option>
            <option value="150" selected="selected">150px</option>
            <option value="200">200px</option>
            <option value="250">250px</option>
        </select>
    </fieldset>
    <fieldset>
        <label for="color">Circle color</label>
        <select name="color" id="color">
            <option value="red">red</option>
            <option value="blue">blue</option>
            <option value="yellow" selected="selected">yellow</option>
            <option value="purple">purple</option>
            <option value="brown">brown</option>
        </select>
    </fieldset>
</div>

</body>
</html>


14
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //자동완성
        var availableTags = [
                             "ActionScript",
                             "AppleScript",
                             "Asp",
                             "BASIC",
                             "C",
                             "C++",
                             "Clojure",
                             "COBOL",
                             "ColdFusion",
                             "Erlang",
                             "Fortran",
                             "Groovy",
                             "Haskell",
                             "Java",
                             "JavaScript",
                             "Lisp",
                             "Perl",
                             "PHP",
                             "Python",
                             "Ruby",
                             "Scala",
                             "Scheme"
                           ];
        $('#tags').autocomplete({
            source: availableTags
        });
    });
</script>
</head>
<body>

<div class="ui-widget">
    <label for="tags">Program Language</label>
    <input type="text" id="tags" />
</div>

</body>
</html>


15
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
    /* 자동완성 스크롤 생성 */
    .ui-autocomplete {
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
  }

</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //자동완성
        var availableTags = [
                             "ActionScript",
                             "AppleScript",
                             "Asp",
                             "BASIC",
                             "C",
                             "C++",
                             "Clojure",
                             "COBOL",
                             "ColdFusion",
                             "Erlang",
                             "Fortran",
                             "Groovy",
                             "Haskell",
                             "Java",
                             "JavaScript",
                             "Lisp",
                             "Perl",
                             "PHP",
                             "Python",
                             "Ruby",
                             "Scala",
                             "Scheme"
                           ];
        $('#tags').autocomplete({
            source: availableTags
        });
    });
</script>
</head>
<body>

<div class="ui-widget">
    <label for="tags">Program Language</label>
    <input type="text" id="tags" />
</div>

</body>
</html>


16
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body {font-size : 80%;}
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //ajax데이터로 자동완성 만들기
        $.ajax({
            url:'./data/london.xml',
            dataType:'xml',
            success: function(datas){
                //data에서 geoname을 찾아서 배열을 만듦
                var data = $('geoname',datas).map(function(){
                    return {
                        //xml데이터 json형태로 만듦
                        value: $('name',this).text() + ', ' + ($.trim($('countryName',this).text()) ||'(unknown country)'),
                        id: $('geonameId',this).text()
                    };
                }).get();
                
                //자동완성
                $('#birds').autocomplete({
                    source: data,
                    //선택시 이벤트
                    select:function(event,ui){
                        alert(ui.item.value + ' / ' +ui.item.id)
                    }
                });
            }
        });
    });
</script>
</head>
<body>

<div class="ui-widget">
    <label for="birds">London matches : </label>
    <input type="text" id="birds" />
</div>

</body>
</html>


17
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="./css/base/jquery-ui.css" />
<style type="text/css">
    body { font-size: 70%; }
    #red, #green, #blue {
    float: left;
    clear: left;
    width: 300px;
    margin: 15px;
  }
  #swatch {
    width: 120px;
    height: 100px;
    margin-top: 18px;
    margin-left: 350px;
    background-image: none;
  }
  #red .ui-slider-range { background: #ef2929; }
  #red .ui-slider-handle { border-color: #ef2929; }
  #green .ui-slider-range { background: #8ae234; }
  #green .ui-slider-handle { border-color: #8ae234; }
  #blue .ui-slider-range { background: #729fcf; }
  #blue .ui-slider-handle { border-color: #729fcf; }
</style>
<script type="text/javascript" src="./js/jquery-3.1.0.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
    if(window.addEventListener) {
        window.addEventListener('load', InitEvent, false); 
    }
    var canvas, context, tool;        
    function InitEvent() {                                       
        canvas = document.getElementById('drawCanvas');
        if(!canvas) {
            alert("캔버스 객체를 찾을 수 없음");
            return;
        }
        if(!canvas.getContext) {
            alert("Drawing Contextf를 찾을 수 없음");
            return;
        }
    context = canvas.getContext('2d');
    if (!context) {
      alert("getContext() 함수를 호출 할 수 없음");
      return;
    }
    // Pencil tool 객체를 생성 한다.
    tool = new tool_pencil();
    canvas.addEventListener('mousedown', ev_canvas, false);
    canvas.addEventListener('mousemove', ev_canvas, false);
    canvas.addEventListener('mouseup',   ev_canvas, false);
    }
    function tool_pencil ()                                   
    {
        var tool = this;
        this.started = false;
        // 마우스를 누르는 순간 그리기 작업을 시작 한다. 
        this.mousedown = function (ev) 
        {
            context.beginPath();
            context.moveTo(ev._x, ev._y);
            tool.started = true;
        };
       // 마우스가 이동하는 동안 계속 호출하여 Canvas에 Line을 그려 나간다
        this.mousemove = function (ev) 
        {
            if (tool.started) 
            {
                context.lineTo(ev._x, ev._y);
                context.stroke();
            }
        };
       // 마우스 떼면 그리기 작업을 중단한다
        this.mouseup = function (ev) 
        {
          if (tool.started){
                tool.mousemove(ev);
                tool.started = false;
          }
        };
    }        
    // Canvas요소 내의 좌표를 결정 한다.
    function ev_canvas (ev) 
    {
        if (ev.layerX || ev.layerX == 0) 
        { // Firefox 브라우저
          ev._x = ev.layerX;
          ev._y = ev.layerY;
        } 
        else if (ev.offsetX || ev.offsetX == 0) 
        { // Opera 브라우저
          ev._x = ev.offsetX;
          ev._y = ev.offsetY;
        }
        // tool의 이벤트 핸들러를 호출한다.
        var func = tool[ev.type];        
        if (func) {
            func(ev);
        }
    }

//색깔
$( function() {
    //선택색깔 16진수 변환
    function hexFromRGB(r, g, b) {
      var hex = [
        r.toString( 16 ),
        g.toString( 16 ),
        b.toString( 16 )
      ];
      $.each( hex, function( nr, val ) {
        if ( val.length === 1 ) {
          hex[ nr ] = "0" + val;
        }
      });
      return hex.join( "" ).toUpperCase();
    }
    //RGB 슬라이더 이벤트
    function refreshSwatch() {
      var red = $( "#red" ).slider( "value" ),
        green = $( "#green" ).slider( "value" ),
        blue = $( "#blue" ).slider( "value" ),
        hex = hexFromRGB( red, green, blue );
        $( "#swatch" ).css( "background-color", "#" + hex );
        //선 색깔 넣기
        context.strokeStyle = $( "#swatch" ).css( "background-color");
    }
    //RGB 슬라이더 UI적용
    $( "#red, #green, #blue" ).slider({
      orientation: "horizontal",
      range: "min",
      max: 255,
      value: 127,
      slide: refreshSwatch,
      change: refreshSwatch
    });
    $( "#red" ).slider( "value", 0 );
    $( "#green" ).slider( "value", 0 );
    $( "#blue" ).slider( "value", 0 );
    
    //선 굵기 슬라이더
    $('#width').slider({
        orientation: "horizontal",
        mix: 1,
        max: 20,
        value: 1,
        change: function(event,ui){
            context.lineWidth= $(this).slider('value');
            $('#line-size').html($(this).slider('value'));
        }
    });
  }); 
</script>
</head>
<body>

<div id="container">
     <canvas id="drawCanvas" width="400" height="300" 
            style=" position: relative; border: 1px solid #000;"></canvas>
</div>

<div id="red"></div>
<div id="green"></div>
<div id="blue"></div>
<div id="swatch" class="ui-widget-content ui-corner-all"></div>


<div id="width"></div>
<div id="line-size"></div>
</body>
</html>