"JQuery 플러그인 toast 실습"의 두 판 사이의 차이

 
(사용자 7명의 중간 판 17개는 보이지 않습니다)
4번째 줄: 4번째 줄:


==소스 코드==
==소스 코드==
<source lang='html5'>
<syntaxhighlight lang='html5'>
<link rel="stylesheet" href="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.css" />
<link rel="stylesheet" href="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.css" />
<script src="//code.jquery.com/jquery-1.6.3.min.js"></script>
<script src="//code.jquery.com/jquery-1.6.3.min.js"></script>
<script src="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.js"></script>
<script src="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.js"></script>
<script>
<script>
function createToast(t){
  function createToast(t) {
  switch(t) {
    switch (t) {
  case 'danger':
      case 'danger':
    $.toast( '<h4>경고!</h4> 위험을 알리는 토스트입니다. 닫아야 없어집니다.', { sticky: true, type: 'danger' } );
        $.toast('<h4>경고!</h4> 위험을 알리는 토스트. 닫아야 없어집니다.', {
    return;
          sticky: true,
  case 'info':
          type: 'danger'
    $.toast( '<h4>알림!</h4> 이것은 이러하기 때문에, 저것은 저러하기 때문에 그렇습니다. 내용을 길게 써보았습니다.', { duration: 4000, type: 'info' } );
        });
    return;
        return;
  case 'success':
      case 'info':
    $.toast( '<h4>성공!</h4> 방금 토스트가 만들어졌습니다. 축배를 듭시다.', { sticky: true, type: 'success' } );
        $.toast('<h4>알림!</h4> 2초간 알려드립니다.', {
     return;
          duration: 2000,
          type: 'info'
        });
        return;
      case 'success':
        $.toast('<h4>성공!</h4> 토스트 생성에 성공했습니다. 닫아야 없어집니다.', {
          sticky: true,
          type: 'success'
        });
        return;
    }
    $.toast('일반적인 토스트. 2초 후 사라집니다.', {
      duration: 2000
     });
   }
   }
  $.toast( '일상적인 토스트입니다. 이 메시지는 자동으로 사라집니다.', { duration: 4000 } );
}


$(document).ready(function(){
  $(document).ready(function() {
  $.toast.config.align = 'right';
    $.toast.config.align = 'center';
  $.toast.config.width = 400;
    $.toast.config.width = 400;
 
 
  $('button').click(function(){
    $('button').click(function() {
    createToast($(this).attr('class'));
      createToast($(this).attr('class'));
     return false;
     });
   });
   });
});
 
</script>
</script>


<button class="">기본 토스트</button>
<br><button class="">기본 토스트</button>
<button class="danger">경고 토스트</button>
<br><button class="danger">경고 토스트</button>
<button class="info">정보 토스트</button>
<br><button class="info">정보 토스트</button>
<button class="success">성공 토스트</button>
<br><button class="success">성공 토스트</button>
</script>
 
</syntaxhighlight>
<jsfiddle height='200'>pfr42oh1</jsfiddle>


<button class="">기본 토스트</button>
==같이 보기==
<button class="danger">경고 토스트</button>
*[[jQuery UI 다이얼로그]]
<button class="info">정보 토스트</button>
<button class="success">성공 토스트</button>
</source>
*예제: http://jmnote.com/jq/plugin_toast.php


==참고 자료==
==참고==
*http://plugins.jquery.com/toast/
*http://plugins.jquery.com/toast/
*https://github.com/Soldier-B/jquery.toast
*https://github.com/Soldier-B/jquery.toast


[[분류: jQuery 플러그인]]
[[분류: jQuery 플러그인]]

2024년 1월 31일 (수) 14:15 기준 최신판

jQuery 플러그인 toast 실습
jQuery 플러그인 토스트 간단예제
jquery.toast 튜토리얼

1 소스 코드[ | ]

<link rel="stylesheet" href="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.css" />
<script src="//code.jquery.com/jquery-1.6.3.min.js"></script>
<script src="//rawgit.com/Soldier-B/jquery.toast/master/jquery.toast/jquery.toast.min.js"></script>
<script>
  function createToast(t) {
    switch (t) {
      case 'danger':
        $.toast('<h4>경고!</h4> 위험을 알리는 토스트. 닫아야 없어집니다.', {
          sticky: true,
          type: 'danger'
        });
        return;
      case 'info':
        $.toast('<h4>알림!</h4> 2초간 알려드립니다.', {
          duration: 2000,
          type: 'info'
        });
        return;
      case 'success':
        $.toast('<h4>성공!</h4> 토스트 생성에 성공했습니다. 닫아야 없어집니다.', {
          sticky: true,
          type: 'success'
        });
        return;
    }
    $.toast('일반적인 토스트. 2초 후 사라집니다.', {
      duration: 2000
    });
  }

  $(document).ready(function() {
    $.toast.config.align = 'center';
    $.toast.config.width = 400;

    $('button').click(function() {
      createToast($(this).attr('class'));
    });
  });

</script>

<br><button class="">기본 토스트</button>
<br><button class="danger">경고 토스트</button>
<br><button class="info">정보 토스트</button>
<br><button class="success">성공 토스트</button>

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}