본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Onsen UI jQuery 사용하기

원문 보기 위키 갱신

Onsen UI jQuery 사용하기 (jQuery)

Onsen UI와 jQuery를 함께 사용하는 것은 꽤 간단해요. 이 페이지에서는 셋업 방법과 CDN에서 두 라이브러리를 함께 로드하는 예제 설치 코드를 안내해 드릴게요.

출처: 문서

본문

jQuery

이 섹션을 읽기 전에 Getting Started와 Fundamentals를 읽어서 Onsen UI의 기초를 먼저 익히는 것을 권장합니다. 걱정 마세요, 5분도 걸리지 않아요.

셋업

jQuery를 Onsen UI와 함께 사용하는 것은 꽤 간단합니다.

  • Onsen UI 다운로드
  • jQuery 받기
  • onsenui.js와 2개의 CSS 파일 로드
  • jQuery 로드

Onsen UI 컴포넌트는 다른 네이티브 DOM 요소처럼 사용할 수 있어요.

예제 설치

다음 코드는 CDN에서 로드된 jQuery와 Onsen UI를 함께 사용하는 방법을 보여줍니다.

<!DOCTYPE html>
<html>
<head>

-

-  <script src="https://unpkg.com/onsenui/js/onsenui.min.js"></script>
  <script src="https://unpkg.com/jquery/dist/jquery.min.js"></script>
</head>
<body>
  <script>
    $(function(){
      // 초기화 코드
      $('ons-button').on('click', function(e) {
        ons.notification.alert('Button is tapped!');
      })
    });
  </script>
  <ons-button>Click me!</ons-button>
</body>
</html>

더 알아보기