반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리


반응형
Be warned of the creation of the component



JavaScript에서 myplugin component를 사용하기 위해 jQuery Mobile은 이 컴포넌트가 생성되는 마지막 단계를 가리키는 이벤트를 generate 합니다. 그 이벤트는  myplugincreate 입니다. ie  그 컴포넌트 이름은 스트링 "create"와 연결 됩니다.


이 이벤트는 jQuery의 standard method들과 같이 사용됩니다. 예를 들어 bind ()live ()같은 메소드들입니다.


Using the creation event of the component


<!DOCTYPE html>

<html> 

<head> 

  <meta name=viewport content="user-scalable=no,width=device-width" />

  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />

  <script src=jquery.js></script>

  <script src=jquery.mobile/jquery.mobile.js></script>

  <script src=jquery.mobile/myplugin.js></script>

</head> 

<body> 

<div data-role=page id=home>

  <div data-role=header>

    <h1>Home</h1>

  </div>

  <div data-role=content>

    <p> Window content </p>  

    <div id=plug1 data-role=myplugin>

      <p>This is my component</p>

    </div>

  </div>

</div>

</body>

</html>

<script>

$("#plug1").bind ("myplugincreate", function ()

{

  alert ("Component created!");

});

</script>



이 이벤트는 그 컴포넌트가 create 됐는지를 알아 낼 때 유용하게 사용될 수 있을 겁니다. 예를 들어 컴포넌트에서 정의 된 메소드를 사용해야 할 경우 등이 되겠죠.




반응형