Live Brilliant

[JQuery] Custom function 본문

개발은 핵찜이야/JQUERY

[JQuery] Custom function

주인정 2012. 7. 5. 14:13

Jquery custom function(사용자정의 함수) 만들기



<html>

    <head>

        <title>jquery </title>

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

        

 <!-- 페이드 아웃 () 메소드는 점점 불투명하게 -->

        <script type="text/javascript">

            $.fn.customcolor = function(color){

                return $(this).css('background',color).fadeOut(3000);

            }

            

            $(document).ready(function(){

                

                $("#button").click(function(){

                    $("h1").customcolor('blue');

                    

                });

                

            });

    </script>

    </head>

    <body>

        <h1>custom functon</h1>

        <ul>

            <li>this is item1</li>

            <li>this is item2</li>

            <li>this is item3</li>

            <li>this is item4</li>

        </ul>

        

        <input type="submit" id="button" value="button">

        

    </body>

</html>

'개발은 핵찜이야 > JQUERY' 카테고리의 다른 글

jquery settimeout redirect  (0) 2013.06.05
jquery mobile data-ajax false[페이지 전환 문제 해결]  (0) 2013.05.31
jquery scroll 사용법  (0) 2013.05.28
li 태그 index 값 출력  (0) 2012.11.21
[JQuery] Ajax load  (0) 2012.07.05
Comments