JQM Swipe-Page

JQM Swipe-Page

I have a JQM site that is using JQM swipe-page.js. just swipes thru 6 different pages.


the script is working as long as there is nothing on the page (no div content) 


here is the script

  1. $( document ).one( "pagecreate", ".demo-page", function() {

  2. $( "#header" ).toolbar({ theme: "b" });
  3. $( "#footer" ).toolbar({ theme: "b" });

  4. function navnext( next ) {
  5. $( ":mobile-pagecontainer" ).pagecontainer( "change", next + ".html", {
  6. transition: "slide"
  7. });
  8. }

  9. function navprev( prev ) {
  10. $( ":mobile-pagecontainer" ).pagecontainer( "change", prev + ".html", {
  11. transition: "slide",
  12. reverse: true
  13. });
  14. }

  15. $( document ).on( "swipeleft", ".ui-page", function( event ) {

  16. var next = $( this ).jqmData( "next" );
  17. if ( next && ( event.target === $( this )[ 0 ] ) ) {
  18. navnext( next );
  19. }
  20. });

  21. $( document ).on( "click", ".next", function() {
  22. var next = $( ".ui-page-active" ).jqmData( "next" );
  23. if ( next ) {
  24. navnext( next );
  25. }
  26. });
  27. $( document ).on( "swiperight", ".ui-page", function( event ) {
  28. var prev = $( this ).jqmData( "prev" );
  29. if ( prev && ( event.target === $( this )[ 0 ] ) ) {
  30. navprev( prev );
  31. }
  32. });

  33. $( document ).on( "click", ".prev", function() {
  34. var prev = $( ".ui-page-active" ).jqmData( "prev" );

  35. if ( prev ) {
  36. navprev( prev );
  37. }
  38. });
  39. });


  40. $( document ).on( "pageshow", ".demo-page", function() {
  41. var thePage = $( this ),
  42. title = thePage.jqmData( "title" ),
  43. next = thePage.jqmData( "next" ),
  44. prev = thePage.jqmData( "prev" );


  45. $( "#trivia-button" ).attr( "href", "#" + thePage.find( ".trivia" ).attr( "id" ) );


  46. $( "#header h1" ).text( title );

  47. if ( next ) {
  48. $( ":mobile-pagecontainer" ).pagecontainer( "load", next + ".html" );
  49. }
  50. $( ".next.ui-state-disabled, .prev.ui-state-disabled" ).removeClass( "ui-state-disabled" );

  51. if ( ! next ) {
  52. $( ".next" ).addClass( "ui-state-disabled" );
  53. }
  54. if ( ! prev ) {
  55. $( ".prev" ).addClass( "ui-state-disabled" );
  56. }
  57. });


here is html:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>New York</title>
  7. <link rel="stylesheet" href="swipe_files/jquery.mobile-1.4.2.min.css">
  8. <link rel="stylesheet" href="swipe_files/jqm-demos.css">
  9. <link rel="stylesheet" href="swipe_files/swipe-page.css">
  10. <script src="swipe_files/jquery.js"></script>
  11. <script src="swipe_files/index.js"></script>
  12. <script src="swipe_files/jquery.mobile-1.4.2.min.js"></script>
  13. <script src="swipe_files/swipe-page.js"></script>
  14. </head>
  15. <body>

  16. <div id="header" data-role="header" data-id="header" data-position="fixed" data-fullscreen="true" data-tap-toggle="true">
  17.     <h1>New York</h1>
  18.     <a href="./" data-ajax="false" data-direction="reverse" data-icon="delete" data-iconpos="notext" data-shadow="false" data-icon-shadow="false">Back</a>
  19. </div><!-- /header -->

  20. <div data-role="page" id="newyork" class="demo-page" data-title="New York" data-dom-cache="true" data-theme="b" data-next="buenosaires">

  21. <div role="main" class="ui-content">

  22. <div id="trivia-newyork" class="trivia ui-content" data-role="popup" data-position-to="window" data-tolerance="50,30,30,30" data-theme="a">
  23.         <a href="#" data-rel="back" class="ui-btn ui-btn-right ui-btn-b ui-btn-icon-notext ui-icon-delete ui-corner-all">Close</a>
  24. <p>Blah Blah Blah</small></p>
  25.         </div>

  26. </div>
  27. <!-- /content -->
  28. <div class="tournament"> 
  29.       <div class="portfolio-item-thumb one-half"> 
  30.         <div class="round quarter-finals"> 
  31.           <div class="match" > 
  32.             <div class="player">Five Finger Death Punch</div>
  33.             <div class="player winner">Player 2</div>
  34.           </div>
  35.           <div class="match"> 
  36.             <div class="player winner">Player 3</div>
  37.             <div class="player">Player 4</div>
  38.           </div>
  39.           <div class="match"> 
  40.             <div class="player">Player 5</div>
  41.             <div class="player winner">Player 6</div>
  42.           </div>
  43.           <div class="match"> 
  44.             <div class="player">Player 7</div>
  45.             <div class="player">Player 8</div>
  46.           </div>
  47.         </div>
  48.       </div>
  49.     </div>
  50. </div>

  51. <!-- /page -->

  52.     <div id="footer" data-id="footer" data-position="fixed" data-fullscreen="true" data-tap-toggle="false">
  53. <div data-role="controlgroup" class="control ui-btn-left" data-type="horizontal" data-mini="true">
  54.         <a href="#" class="prev ui-btn ui-btn-icon-notext ui-icon-carat-l">Previous</a>
  55.         <a href="buenosaires.html" class="next ui-btn ui-btn-icon-notext ui-icon-carat-r">Next</a>
  56.         </div>

  57. <a href="#trivia-newyork" id="trivia-button" data-rel="popup" class="trivia-btn ui-btn ui-btn-right ui-btn-icon-left ui-icon-info ui-mini ui-corner-all">Trivia</a>
  58.     </div><!-- /footer -->

  59. </body>
  60. </html>

when the yellow highlighted code in the content is NOT there, everything works perfect. 

When I add the highlighted code, I cant swipe anymore. It will swipe if i can grab a little bit of the background outside of that highlighted code area. 

 Any ideas why when I add that div content in there, it covers up the swipe ability? 

just in case, here is the css as well... 
  1. .demo-page {
  2. background-size: cover;
  3. background-position: center center;
  4. background-repeat: no-repeat;

  5. }

  6. .demo-page .ui-footer {
  7. background: #000;
  8. border: none;
  9. bottom: 0;
  10. }

  11. .control.ui-btn-left,
  12. .trivia-btn.ui-btn-right {
  13. top: auto;
  14. bottom: 7px;
  15. margin: 0;
  16. }

  17. small {
  18. font-size: .75em;
  19. color: #666;
  20. }

any suggestions would be awesome! Thanks

here is the non-working page...


to best see the issue, look on mobile,(it will swipe on browser with mouse if you grab the bg area)