Advertisement
Guest User

Phonegap scrolling issue

a guest
Apr 25th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.69 KB | None | 0 0
  1. index.html
  2.  
  3. <html>
  4.     <head>
  5.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6.         <meta name="format-detection" content="telephone=no" />
  7.         <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no">
  8.         <title>Test application</title>
  9.  
  10.         <script type="text/javascript" src="js/cordova-2.5.0.js"></script>
  11.         <script src="js/jquery-1.9.1.min.js"></script>
  12.         <script src="js/jquery.animate-enhanced.js"></script>
  13.         <script src="js/iscroll.js"></script>
  14.         <script src="js/handlebars.js"></script>
  15.         <script src="js/noClickDelay.js"></script>
  16.  
  17.         <link rel="stylesheet" href="js/viewnavigator/viewnavigator.css" type="text/css" />
  18.         <script src="js/viewnavigator/viewnavigator.js"></script>
  19.        
  20.         <link rel="stylesheet" href="css/app.css" />
  21.         <script src="js/app.js"></script>
  22.     </head>
  23.     <body>
  24.         <div id="pageContent"></div>
  25.  
  26.         <script type="text/x-handlebars-template" id="mainTemplate">
  27.                 <div class="wrapper">
  28.                         <a href="#">Test 1</a>  
  29.                         <a href="#">Test 2</a>  
  30.                         <a href="#">Test 3</a>  
  31.                         <a href="#">Test 4</a>  
  32.                         <a href="#">Test 5</a>  
  33.                         <a href="#">Test 6</a>  
  34.                         <a href="#">Test 7</a>  
  35.                         <a href="#">Test 8</a>  
  36.                         <a href="#">Test 9</a>  
  37.                         <a href="#">Test 10</a>
  38.                         <a href="#">Test 11</a>
  39.                         <a href="#">Test 12</a>
  40.                         <a href="#">Test 13</a>
  41.                         <a href="#">Test 14</a>
  42.                         <a href="#">Test 15</a>
  43.                         <a href="#">Test 16</a>
  44.                         <a href="#">Test 17</a>
  45.                         <a href="#">Test 18</a>
  46.                         <a href="#">Test 19</a>
  47.                         <a href="#">Test 20</a>
  48.                 </div>
  49.         </script>
  50.     </body>
  51. </html>
  52.  
  53. app.css
  54.  
  55. html {font-size:12px}
  56. html,body,#pageContent {position:absolute;top:0px;left:0px;right:0px;bottom: 0px;}
  57. body,.viewNavigator_contentHolder {background:#00a0c0}
  58. .wrapper {min-width:100%;height:100%}
  59. a {color:#f5f5f5;display:block;font-size:180%;padding:20px 30px;border-bottom: 1px solid #eaeaea};
  60. a:hover {color:#eaeaea}
  61.  
  62. app.js
  63.  
  64. function Controller() {
  65.  
  66.         if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
  67.                 document.addEventListener("deviceready", this.onDeviceReady, false);
  68.         } else {
  69.                 this.onDeviceReady();
  70.         }
  71.  
  72. }
  73.  
  74. Controller.prototype.onDeviceReady = function() {
  75.  
  76.         $(document).ready(function() {
  77.                 $(document).bind( "touchmove", function (e) { e.preventDefault(); return false; } );
  78.  
  79.                 setTimeout( function() {var app = new App();} , 100 );
  80.         });
  81. }
  82.  
  83. var controller = new Controller();
  84.  
  85.  
  86. function App() {
  87.  
  88.         var obj = this;
  89.  
  90.         obj.template = null;
  91.  
  92.         obj.init();
  93. }
  94.  
  95. App.prototype.init = function() {
  96.  
  97.         var obj = this;
  98.  
  99.         obj.template = Handlebars.compile($("#mainTemplate").html());
  100.         window.viewNavigator = new ViewNavigator('#pageContent');
  101.         var view = obj.getView( obj.template, "Title", null);
  102.         window.viewNavigator.pushView(view);
  103. }
  104.  
  105. App.prototype.getView = function(view, title, params) {
  106.  
  107.         var obj = this;
  108.  
  109.         return {title: title,
  110.                 backLabel: null,
  111.                 view: view
  112.                };
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement