프로그래밍/자바스크립트

Javascript - jQuery Mobile 유틸리티

가카리 2015. 2. 2. 21:29
반응형

1.   $.mobile.changePage() 메소드


    


2.   $.mobile.loadPage() 메소드





3.   $.mobile.loading() 메소드



19-01.html


<!DOCTYPE html>

<html lang="en">

  <head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>19-01</title>

    <link rel="stylesheet"  href="js/jquery.mobile-1.3.2.css" />

    <script src="js/jquery-1.11.1.js"></script>

    <script type="text/javascript">

      $(document).on('mobileinit', function() {

        $.mobile.loader.prototype.options.theme = "a";

        $.mobile.loader.prototype.options.text = "loading";

        $.mobile.loader.prototype.options.textonly = false;

        $.mobile.loader.prototype.options.textVisible = false;

      });

      

      $(document).on('pagecreate', function() {

        

        //디폴트임

        $('#default').on('tap', function(event) {

          $.mobile.loading('show', {

            theme: $.mobile.loader.prototype.options.theme,

            text: $.mobile.loader.prototype.options.text,

            textonly: $.mobile.loader.prototype.options.textonly,

            textVisible: $.mobile.loader.prototype.options.textVisible

          });

        });

        

        // 바꿔봄

        $('#textonly').on('tap', function(event) {

          $.mobile.loading('show', {

            theme: $.mobile.loader.prototype.options.theme,

            text: "텍스트만 표시되는 로더",

            textonly: true,

            textVisible: true

          });

        });


        //텍스트를 바꿔봄 테마도 바꿈

        $('#theme_a').on('tap', function(event) {

          $.mobile.loading('show', {

            theme: "a",

            text: "페이지 로딩 (Theme a)",

            textonly: false,

            textVisible: true

          });

        });

        

        $('#theme_b').on('tap', function(event) {

          $.mobile.loading('show', {

            theme: "b",

            text: "페이지 로딩 (Theme b)",

            textonly: false,

            textVisible: true

          });

        });

        

        

        //진행 상태를 제거해라

        $('#hide').on('tap', function(event) {

          $.mobile.loading('hide');

        });

        

      });   

                

    </script>

    <!--역시 mobile 참조하기 전에 스크립트를 짜야된다. -->

    <script src="js/jquery.mobile-1.3.2.js"></script>

  </head>


  <body>

    <div data-role="page" id="main">

      <div data-role="header" data-position="fixed">

        <h3>Utilities</h3> 

      </div>

      <div data-role="content">

        <p>메시지 로더</p>

        <div>

          <button id="default">Default Loader</button>

          <button id="textonly">Text Only</button>

          <button id="theme_a" data-theme="a">Theme a</button>

          <button id="theme_b" data-theme="b">Theme b</button>

          <button id="hide">Hide</button>

        </div>

      </div>

      <div data-role="footer" data-position="fixed">

        <h4>&copy; 2014 T academy</h4>

      </div>

    </div>

  </body>

</html>



출력화면




반응형