Book Image

Drupal 7 Mobile Web Development Beginner's Guide

By : Tom Stovall
Book Image

Drupal 7 Mobile Web Development Beginner's Guide

By: Tom Stovall

Overview of this book

<p>How disappointing is it to log on to a website for a product or business you love only to discover the feature you were drawn to doesn’t work on your mobile or tablet? Drupal has brand new features to adapt your existing site into a mobile site that will keep your customers coming back.</p> <p>The Drupal Mobile Web Development Beginner's Guide follows a humble 'Mom &amp; Pop' restaurant website which gets a makeover complete with cutting edge features that play to mobile, tablet and desktop audiences. By following the fun example, you will finish the book having effortlessly adapted your website so that it is accessible and, more importantly, looks good and functions well, on any mobile device.</p> <p>Restaurant websites are notoriously horrible to navigate and our Mom &amp; Pop example is wellintentioned but no exception to this rule. We bring this site out of the early 1990's with cutting edge development practices and a team development workflow. This pizza chain goes mobile with location services, audio, video, charting and mapping worthy of any multi-million dollar site. Each chapter examines the way the site works and shows you how to move the existing content and functionality into reusable features.</p>
Table of Contents (18 chapters)
Drupal 7 Mobile Web Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Pop quiz Answers

A room with a viewport


Since their earliest version, mobile browsers have been able to do something desktop browsers cannot and that was scaling the screen. They've had to do this because screen real estate on handhelds is at a premium. Before the iPhone perfected the pinch to zoom, you could use keys on Nokia and Blackberry browsers to zoom into and out of a rendered HTML screen. Most mobile browsers assume that standard HTML documents are meant to have a width of 980 pixels. Fortunately, you can control the width of the rendered screen with a<meta> tag. You can set the viewport scale at the optimum width for whatever screen on which its being viewed. I usually set the viewport at the optimum for the 320 by 480 pixels screen and use JavaScript to change the settings if the screen is larger.

Let's take a look at the settings in the html.tpl.php file:

<meta name="viewport" content="width=760, initial-scale=0.74, minimum-scale=0.4">

We can use JavaScript to adjust this setting...