Create an iPhone Optimised Website using jQTouch

Initialize jQTouch

Go back to your global.js file and insert the following:

icon: Sets the home screen icon for the application
addGlossToIcon: glossy button effect on icon
startupScreen: Pass a string path to a 320px x 460px startup screen for full screen apps.
statusBar: ‘default’ – Styles the status bar when running as a fullscreen app.
preloadImages: Pass an array of image paths to load them before page loads. Ex: [‘images/link_over.png’, ‘images/link_select.png’]

var jQT = new $.jQTouch({
   icon: 'jqtouch.png',
   addGlossToIcon: true,
   startupScreen: 'jqt_startup.png',
   statusBar: 'black',
   preloadImages: []

Creating the Content

Add the following after the opening body tag. This will be the content that is displayed on the first page the user sees. Effectively, our homepage. jQTouch will treat each div id on our page as it’s own separate page of content. So #portfolio will be it’s own page, so will #contact and so on and so forth.

<div id="home" class="current page">
   <h2><a href="/" id="logo">Freelance Web Design</a></h2>
   <h2>Matthew Leak is an Interactive Web Designer with a passion for simplicity</h2>

<ul class="links">
	<li><a href="#about">About Me</a></li>
	<li><a href="#portfolio">Portfolio</a></li>
	<li><a href="#contact">Get in Touch</a></li>
	<li><a href="" target="_blank">Twitter</a></li>

 <!-- #home close -->

Styling the Content

Open up main.css add the following CSS:

body {
        background-color: #f7f9f9;

	background: url('../img/matthewleak-logo.png') no-repeat;
	height: 0;
	width: 0;
	padding: 110px 0 0 110px;
	display: block;
	overflow: hidden;
	margin: 30px auto;

	color: #282829;
	font-family: Times New Roman, serif;
	font-size: 13px;
	font-weight: normal;
	letter-spacing: 2px;
	line-height: 21px;
	margin: 30px 15px;
	text-align: center;
	text-shadow: 1px 1px 0px #fff;
	text-transform: uppercase;

#home ul.links{
	margin: 0 15px 30px 15px;

#home ul.links li{
	background: url('../img/arrow.png') right center no-repeat;
	border-bottom: 1px dotted #bababa;
	font-family: Helvetica, Arial, sans-serif;
	font-size: 12px;
	letter-spacing: 2px;
	list-style: none;
	text-transform: uppercase;
	width: 100%;
	padding: 20px 0 20px 0;

#home ul.links li a{
	color: #282829;
	font-weight: bold;
	text-decoration: none;
	padding: 0 100px 0 0;

Pages: 1 2 3 4 5

This entry was posted on Monday, June 7th, 2010 at 09:00 and is filed under Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Matthew Leak is a freelance Web Designer and Developer from Manchester in the UK with an avid interest for new and exciting web technologies and trends. Follow Matthew’s updates on Twitter and be sure to check out his blog.

About the author Published by Matthew Leak

19 Responses »

  1. Isn’t it awesome? 🙂

  2. Can’t see the demo… blank site!
    Google Chrome, by the way.

  3. The demo is working for me? Are you trying to view the demo with Javascript disabled?

  4. I really like and appreciate your blog.Really thank you! Awesome.

  5. The sliding did not work for me after following the tutorial. After troubleshooting, I found that the global.js is missing this part which is responsible for the sliding from one page to another:

    name: ‘slide’,
    selector: ‘.revealme’

    In the end the content of my global.js file looks like this:

    var jQT = new $.jQTouch({
    icon: ‘jqtouch.png’,
    addGlossToIcon: true,
    startupScreen: ‘jqt_startup.png’,
    statusBar: ‘black’,
    preloadImages: []

    name: ‘slide’,
    selector: ‘.revealme’

    And then the app started working like your demo.

    Thanks for this tutorial!

  6. Nice Tutorial! I’m also playing around with jqTouch actually
    but reached very fast my boundaries of comprehension about
    jQuery + jqTouch.

    For example, use custom events or trigger something if first li is entered. Or why the hell already tested functions dont work anymore
    or with interrupts.
    I think i need more table edges for my head here.

    If you are interest, you can have a look about it here:

    Best regards,

  7. Making a website is really not that tough, and top of all, you can create a website or more website for free.
    Building a website is a extremely individual skill and is different with each client.
    It is more about revealing your business to new probable clients and generating new sales.

  8. Hi,

    Thanks for the tutorial. Just a little observation about the viewport metas. These seem to be useless unless you set the fixedViewport option to false when initializing jQTouch.

    Indeed, this option is set to true by default so jQTouch defines its own values for the viewport.

    On the example above, the values set in the metas are the same than the jQTouch ones, so no everything’s displayed as expected. But if you wanna change the scales, for example, you have to set the fixedViewport to false.

  9. These lines:

    are actually not required if you set the fullScreen and statusBar options to true, so jQTouch will take care of it.

    I know these are details, but I think it’s cleaner to let jQTouch do the job 😉

    Anyway, this library definitely needs a documentation… >_<'

  10. Argh, the lines of code were filtered. I was talking about the “apple-mobile-web-app-capable” and “apple-mobile-web-app-status-bar-style” metas.

  11. does this work on android phones?
    (i don;t have an android to check)

    • Amazing, you have explained all the fundamentals of jqtouch for websites, including a detailed explaination of the viewport (which before didn’t really know much about), and plus it works almost seamlessly on Android! Thanks Matt!

  12. Hi,
    Thanks for Wonderful tutorial.
    I have one question.
    Your all page was static, if i want to dynamic pages from than how it will work?


  13. Hey is there any reason why this doesnt work on a blackberry phone? I know this is ment for iPhone but what if i wanted to use this for blackberry too. Any suggestions on how to get this to work?

  14. Hello
    I had tried everything but the menu can not be clicked.Links works sometimes only the first two and so there is no more..I’ve tried thet tip from Hari butdid not helpt..