CpS 401 Notes

Intro to Mobile Web Development



Introduction



Mobile Safari/WebKit Basics

Viewport

jQuery Mobile Fundamentals

Page Design

Basic structure:

<!DOCTYPE html> 
<html> 
        <head> 
        <title>My Page</title> 
        <meta name="viewport" content="width=device-width, initial-scale=1"> 
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
        <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head> 
<body> 
</body>
</html>



Using div tags

Using new HTML 5 tags

<div class="section" id="page1">
  <div class="header"><h1>jQuery Mobile</h1></div>
  <div class="content">
    <p>First page!</p>
  </div> <!-- content -->
  <div class="footer"><h1>O'Reilly</h1></div>
</div> <!-- section -->
<section id="page1">
  <header><h1>jQuery Mobile</h1></header>
  <div class="content">
    <p>First page!</p>
  </div>
  <footer><h1>O'Reilly</h1></footer>
</section>



<section id="page1" data-role="page">
  <header data-role="header"><h1>jQuery Mobile</h1></header>
  <div class="content" data-role="content">
    <p>First page!</p>
  </div>
  <footer data-role="footer"><h1>O'Reilly</h1></footer>
</section>

Page Organization


Links

jQM uses JavaScript to replace the standard link and form submission behavior with its own AJAX-style processing.

Three kinds of links in a jQM page:





Forms