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>


댓글 없음:

댓글 쓰기