File: samepagetransition.html

package info (click to toggle)
jquery-mobile 1.4.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 15,808 kB
  • sloc: makefile: 42; php: 18
file content (80 lines) | stat: -rw-r--r-- 2,621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
  <title>JQM latest - issue template</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" href="../css/themes/default/jquery.mobile-1.4.5.min.css">
  <script src="../js/jquery.js"></script>
  <script src="../js/jquery.mobile-1.4.5.min.js"></script>
  <script>
    // JS
  </script>
  <style>
    #edit-with-js-bin { display: none !important; }
  </style>
</head>
<body>
<div data-role="page" id="page1" data-theme="a">
  
  <div data-role="header">
    <h1>same page transitions</h1>
    <div data-role="navbar" id="navh1">
      <ul>
        <li><a href="#page1">fade</a></li>
        <li><a href="#page1">pop</a></li>
        <li><a href="#page1">flip</a></li>
        <li><a href="#page1">turn</a></li>
        <li><a href="#page1">flow</a></li>
      </ul>
    </div>
  </div><!-- /header 1 -->

  <div role="main" class="ui-content">
     <h1>same page transitions</h1>
     <div>All links within this page navigate to the page itself having the <code>allowSamePageTransition</code> option at <code>changePage()</code> method set to <strong>true</strong>. It seems, just the slide transition raises an issue so the page gets hidden.
      <label><input type="checkbox" id="cb1" data-theme="b"> reverse transition </label>
      <label><input type="checkbox" id="cb2" data-theme="b"> add ui-page-active on pageshow </label>
    </div>
      <div id="p1"></div>
    </div><!-- /content 1 -->

  <div data-role="footer">
    <div data-role="navbar" id="nav1">
      <ul>
        <li><a href="#page1">slide</a></li>
        <li><a href="#page1">slidefade</a></li>
        <li><a href="#page1">slideup</a></li>
        <li><a href="#page1">slidedown</a></li>
        <li><a href="#page1">none</a></li>
      </ul>
    </div>
  </div><!-- /footer 1 -->

<script>
$('#page1').on('pagecreate', function() {

    $('a').bind('click', function(e) {
    var trans = $(this).text() || 'none',
        rev = !!$('#cb1').attr('checked');

    $.mobile.changePage('#page1', { transition: trans,
                                    allowSamePageTransition: true,
                                    reverse: rev } );
    $('#p1').text( 'last transition: ' + trans + ' - reverse: ' + rev );
  });
});

$('#page1').bind('pagehide', function(e) {
  $('a.ui-btn').removeClass('ui-btn-active');
  if ( !!$('#cb2').attr('checked') && !$(this).hasClass('ui-btn-active') ) { 
    $(this).addClass('ui-page-active');
  }
});    

</script>

</div><!-- /page 1 -->
</body>    
</html>