[Table.htm]



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>예시 테이블</title>

</head>

<body>

    <table class="tbl" border="1">

        <thead>

            <tr>

                <th>&nbsp;</th>

                <th>제목</th>

                <th>저자</th>

                <th>출간일</th>

                <th>가격</th>

            </tr>

        </thead>

        <tbody>

            <tr>

                <td><img src="../../ProductImages/thumbs/BOOK-01.jpg" /></td>

                <td>쉽게 배우는 ASP.NET 2.0</td>

                <td>박용준</td>

                <td>2008</td>

                <td>20000</td>

            </tr>

            <tr>

                <td><img src="../../ProductImages/thumbs/COM-01.jpg" /></td>

                <td>.NET Bible</td>

                <td>박용준</td>

                <td>2003</td>

                <td>25000</td>

            </tr>

            <tr>

                <td><img src="../../ProductImages/thumbs/HARDWARE-01.jpg" /></td>

                <td>정보처리기능사</td>

                <td>박용준</td>

                <td>2000</td>

                <td>18000</td>

            </tr>

        </tbody>

    </table>

</body>

</html>

 



-------------------------------------------------------------------------------------




[실행결과]






Posted by holland14
:



[Tooltip.htm]



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>툴팁 : 풍선 도움말</title>

    <style type="text/css">

        .tooltiptitle { background-color:Silver; }

        .tooltipcontent { background-color:Yellow; }

        .tooltiplayer { display:none;width:250px;height:100px;border:1px solid gray; }

    </style>

    <script src="../../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            // tt class에 마우스 오버

            $('.tt').mouseover(function (e) {

                // 현재 오버된 개체에서 마우스 움직일 때

                $(this).mousemove(function (e) {

                    // title <span> 찾아서 내용 비우고, 현재 <span>의 텍스트를 삽입

                    $('#tooltiplayer #title').empty().append($(this).text());

                    $('#tooltiplayer #content').empty().append($(this).text());

                   

                    var t = e.clientY - 15; // 상단 좌표

                    var l = e.clientX + 20; // 좌측 좌표

                    $('#tooltiplayer')

                        .css({ "top": t, "left": l, "position": "absolute", "opacity": "0.8" })

                        .show(); // 레이어 보이기

                }); // end mousemove               

            }); // end mouseout

 

            // tt class에 마우스 아웃

            $('.tt').mouseout(function() {

                $('#tooltiplayer').hide(); // 레이어 숨기기

            });

        });

    </script>

</head>

<body>

    <div id="tooltiplayer" class="tooltiplayer">

        <div class="tooltiptitle">

            <span id="title">제목들어오는 곳</span>

        </div>

        <div class="tooltipcontent">

            <span id="content">내용들어오는 곳</span>

        </div>

    </div>   

    <table border="1">

        <tr>

            <td><span class="tt">안녕하세요</span></td>

        </tr>

        <tr>

            <td><span class="tt">반갑습니다</span></td>

        </tr>

        <tr>

            <td><span class="tt">또 만나요</span></td>

        </tr>

    </table>   

</body>

</html>

 




-------------------------------------------------------------------------------------

 


[실행결과]





 

 

 


 

Posted by holland14
:



[CheckBoxAllCheck.htm]




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>체크박스 전체선택 및 해제</title>

    <script src="../../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            //[1] 전체선택 체크박스 클릭시

        $('#chkAll').click(function() {

                // ul에 포함되어져 있는 모든 체크박스를 가져옴

                var $checkboxes = $(this).parents('ul:first').find(':checkbox');

                // chkAll 체크되어져 있다면, "전체선택" -> "선택해제"

                if (this.checked) {

                    $(this).next().text("선택해제"); // <em>의 텍스트 "선택해제"로 변경

                    $checkboxes.attr('checked', 'true'); // 모든 체크박스에 checked속성을 추가

                }

                else {

                    $(this).next().text('전체선택');

                    $checkboxes.attr('checked', '');

                }

            });

        });

    </script>

</head>

<body>

    <ul>

        <li><label><input type="checkbox" id="chkAll" /><em>전체선택</em></label></li>

        <li><label><input type="checkbox" id="Checkbox1" />C#</label></li>

        <li><label><input type="checkbox" id="Checkbox2" />ASP.NET</label></li>

        <li><label><input type="checkbox" id="Checkbox3" />Silverlight</label></li>

        <li><label><input type="checkbox" id="Checkbox4" />WPF</label></li>

    </ul>

</body>

</html>

 




-------------------------------------------------------------------------------------

 


[실행결과]
















 

 

 


 

Posted by holland14
:




[MyPlugInPhotoView.htm]

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>사진 상세 보기 플러그인 제작</title>

    <link href="jquery.MyPlugIn.PhotoView.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script src="jquery.MyPlugIn.PhotoView.js" type="text/javascript"></script>

        <script type="text/javascript">

            $(document).ready(function () {

                // 썸네일 이미지 개체 리스트에 상세 이미지 출력

                $('#products img').photoview({

                    photoElement: '#photo',     // 사진을 보여줄 개체

                    previousControl: '#prev',   // 이전버튼 개체

                    nextControl: '#next',       // 다음버튼 개체

                    firstControl: '#first',     // 처음버튼 개체

                    lastControl: '#last'        // 마지막버튼 개체   

                });

            });

        </script>

</head>

<body>

    <h1>상품 상세 보기</h1>

    <div id="products">

        <img src="../ProductImages/thumbs/BOOK-01.jpg" />

        <img src="../ProductImages/thumbs/COM-01.jpg" />

        <img src="../ProductImages/thumbs/HARDWARE-01.jpg" />

        <img src="../ProductImages/thumbs/Online-01.jpg" />

        <img src="../ProductImages/thumbs/SOFTWARE-01.jpg" />

    </div>

       

    <div id="big">

        <img id="photo" src="" alt="상세 이미지" />

    </div>

    <div id="navi">

        <button type="button" id="first">처음</button>

        <button type="button" id="prev">이전</button>

        <button type="button" id="next">다음</button>

        <button type="button" id="last">마지막</button>

    </div>

</body>

</html>

 

 


-------------------------------------------------------------------------------------




[jquery.MyPlugIn.PhotoView.css] 



#products {

    float : left;

    width : 175px;

    height: 400px;

    overflow: auto;

    border: 1px solid red;

    margin-right: 10px;

}

 

#navi {

    clear: both;

    text-align: left;

}

 



-------------------------------------------------------------------------------------

 


[jquery.MyPlugIn.PhotoView.js]


(function($) {

 

    var settings; // 한개 이상의 매개변수를 담을 그릇 : params, 해시

 

    // photoview라는 이름의 jQuery 플러그인 생성

    $.fn.photoview = function(callerSettings) {

 

        // extend 함수에 의해 한 개 이상의 매개변수를 동적으로 받을 수 있다.

        settings = $.extend({

            photoElement: '#photoviewPhoto', // 넘겨온 썸네일 포토리스트

            transformer: function(name) { return name.replace(/thumbs/, 'bigs'); }, // 큰 이미지의 경로

            nextControl: null, // 다음 버튼, 지정하지 않으면 설정되지 않는다.

            previousControl: null, // 이전 버튼

            firstControl: null, // 처음 버튼

            lastControl: null // 마지막 버튼

        }, callerSettings || {}); // 공식과 같은 코드(?)

 

 

        settings.photoElement = $(settings.photoElement);

        settings.thumbnails = this.filter('img'); // img 요소만 settings thumbnails 프로퍼티에 저장

        settings.thumbnails.each(function(n) { this.index = n; });

        settings.current = 0; // 현재 보여지는 이미지의 인덱스 저장

 

        // 썸네일 목록을 순회하여 index 속성에 담음

        settings.thumbnails.click(function() { showPhoto(this.index); });

        // 나머지 연산자를 사용하여 리스트의 끝에 도달 시 인덱스를 다시 처음으로 설정

        settings.photoElement.click(function() {

            showPhoto((settings.current + 1) % settings.thumbnails.length);

        });

 

        // 처음

        $(settings.firstControl).click(function() {

            showPhoto(0);

        });

 

        // 이전

        $(settings.previousControl).click(function() {

            showPhoto((settings.thumbnails.length + settings.current - 1) %

                settings.thumbnails.length);

        });

 

        // 다음

        $(settings.nextControl).click(function() {

            showPhoto((settings.current + 1) % settings.thumbnails.length);

        });

 

        // 마지막

        $(settings.lastControl).click(function() {

            showPhoto(settings.thumbnails.length - 1);

        });

 

        // 처음로드시 첫번째 이미지를 보여줌.

        showPhoto(0);

 

        return this;

    };

 

 

    // 사진 보여주기 함수

    var showPhoto = function(index) {

        settings.photoElement

      .attr('src', // src 속성에 대입

        settings.transformer( // transformer 함수를 사용하여 썸네일을 큰이미지로 변경

            settings.thumbnails[index].src)); // index에 해당하는 썸네일의 src 특성을 찾는다.

        settings.current = index; // 현재 인덱스를 다시 저장

    };

 

})(jQuery);

 



-------------------------------------------------------------------------------------


[실행결과]




 

 


 

Posted by holland14
:



[Replace.htm]



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>새로운 함수를 만들기</title>

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script type="text/javascript">

        // 함수 확장 : 나만의 jQuery 메서드 만들기

        // 넘겨온 값(jQuery개체)을 새로운 HTML로 대체

        $.fn.replaceWith2010 = function(html) {

            return this.after(html).remove(); // 넘겨온 HTML로 대체 후 기존 값 제거

        };

        $.fn.Exec = function(a, b) {

            var r = a + " * " + b + " = " + (a * b); // 계산식 문자열 생성

            return this.empty().append(r); // 지정된 개체의 내용 비우고, 문자열 추가

        };

        $(document).ready(function() {

            $('#btn1').click(function() {

                $('#my').empty();

                $('#my').append("<h3>반갑습니다.</h3>");

            });

 

            $('#btn2').click(function() {

                // 없었던 함수(메서드)가 생성

                $('#my').replaceWith2010("<div id='my'><h3>또 만나요.</h3></div>");

            });

            $('#calc').Exec(3, 5); // calc 레이어에 "3 * 5 = 15"를 출력하는 함수 확장

                $('#calc').replaceWithCalc("<div id='calc'><h3>3 * 5 = 15</h3></div>");

            });

    </script>

</head>

<body>

    <input type="button" id="btn1" value="값 변경" />

    <input type="button" id="btn2" value="값 변경" />

    <div id="my">

        <h3>안녕하세요.</h3>

    </div>   

    <div id="calc"></div>

</body>

</html>

 



-------------------------------------------------------------------------------------

 


[실행결과]


 











 

 

  

Posted by holland14
:


 

jQuery 플러그인

 

  • jQuery 명령어로 만들어진 또다른 기능들의 집합
  • jQuery 사이트에 등록된 수천개의 플러그인
  • 내가 원하는 플러그인을 검색해서 사이트에 적용
  • , 충분한 테스트를 사용 권장


Posted by holland14
:



[Tabs.htm]



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>탭 컨트롤</title>

    <link href="ui.tabs.css" rel="stylesheet" type="text/css" />

    <link href="ui.theme.css" rel="stylesheet" type="text/css" />

    <link href="ui.core.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script src="../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $('#tabs').tabs(); //

        });

    </script>

</head>

<body>

    <div id="tabs">

        <ul>

            <li><a href="#tabs-1">탭 제목1</a></li>

            <li><a href="#tabs-2">탭 제목2</a></li>

            <li><a href="#tabs-3">탭 제목3</a></li>

        </ul>

        <div id="tabs-1">첫번째 영역의 내용</div>

        <div id="tabs-2">두번째 영역</div>

        <div id="tabs-3">세번째 영역</div>

    </div>

</body>

</html>  




-------------------------------------------------------------------------------------

 


[실행결과]











 

 

 


 

Posted by holland14
:



[Accordion.htm] 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>아코디언 컨트롤</title>

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script src="../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $('#accordion').accordion({event:"mouseover"});

        });

    </script>   

</head>

<body>

    <div id="accordion">

        <h3>제목1</h3>

        <div>내용1</div>

        <h3>제목2</h3>

        <div>내용2</div>

        <h3>제목3</h3>

        <div>내용3</div>

    </div>

</body>

</html>

 

 

-------------------------------------------------------------------------------------

 


[실행결과]


 


 

 


 

Posted by holland14
:



[Selectable.htm]



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>개체 선택</title>

    <style type="text/css">

        .ui-selected { background-color:Yellow;color:Black; }

    </style>   

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script src="../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $('ul').selectable(); // 선택

        });

    </script>

</head>

<body>

    <ul>

        <li>XHTML</li>

        <li>CSS</li>

        <li>JavaScript</li>

    </ul>

</body>

</html>

 



-------------------------------------------------------------------------------------

 


[실행결과]


--> 첫 화면.





--> 마우스로 '드래그'하여 선택한 영역만 노란색으로 표시되었다.
 

 

 

 


 

Posted by holland14
:



[Sortable.htm]

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>개체 정렬</title>

    <script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>

    <script src="../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            $('ul').sortable({

                axis:"y",

                opacity:0.5

            });

            $('tr').sortable({axis:"x", opacity:0.5});

        });

    </script>

</head>

<body>

    <ul>

        <li>XHTML</li>

        <li>CSS</li>

        <li>JavaScript</li>

    </ul>   

    <table border="1">

        <tr>

            <td>첫번째 셀</td><td>두번째 셀</td>

        </tr>

    </table>

</body>

</html>

 

 


-------------------------------------------------------------------------------------

 


[실행결과]









 

 

 


 

Posted by holland14
: