• On CHOW: His burger will EAT your burger
advertisement
July 6, 2007 12:00 AM PDT

The iPhone Web app navigation template

by Ben Wilson
  • Font size
  • Print
  • 6 comments

Web developer Joe Hewitt has created an ingeniously simple combination of JavaScript and CSS code that turns standards-based HTML lists into pages that act just like the iPod function on the iPhone -- sliding, navigable menus. To see just how well this template works, load this page on your iPhone:

The CSS and JavaScript files are located, respectively, at:

Feedback? info@iphoneatlas.com.

Recent posts from iPhone Atlas
Motorola, RIM leading, with Apple on the rise
Tales2Go: Get on-demand audiobooks for children
iCatchall: 27 apps for free--Monday only
Caps lock--David's iPhone tip of the week
HouseKeeper app reminds you to do forgotten chores
App Genie: 27 apps for 99 cents
Apple extends iTunes Web previews to apps
Possible proof surfaces that iPad supports a camera
Add a Comment (Log in or register) (6 Comments)
  • prev
  • next
by bobcrowley July 1, 2009 8:28 AM PDT
Actually this thing starts out great!

However, I now have difficulty cause I would like to navigate out of the page or submit a form to another page?

Any ideas?

Here is a PHP sample give a small rename file form:

<?php

$divs .= "<div id=\"rename-".md5( $dir."/".$item )."\" class=\"panel\" title=\"Rename ".$item."\">
";
$divs .= "<h2>Type in the new name:</h2>
";
$divs .= "<form name=\"rename-".md5( $dir."/".$item )."\" method=\"post\" action=\"index.php\" >
";
$divs .= "<input type=\"hidden\" name=\"from\"; value=\"".$dir."/".$item."\" />
";
$divs .= "<input type=\"text\" name=\"to\"; value=\"".$item."\" /><br />
";
$divs .= "<input type=\"submit\" name=\"action\"; value=\"rename\" />
";
$divs .= "</form>
";
$divs .= "</div>
";
?>

So when i click the submit button niks, nada, nothing....

Same goes I think for just generic links.... it doesn't go...

<?php

$divs .= "<a href=\"http://www.google.com\">google</a>
";

?>

Its like the javascript completely takes over and mods the links.
Reply to this comment
by turkeylurkey September 17, 2009 7:30 PM PDT
Yeah! Great page!! But how do you bust out? I want to add some video links. hmmmmm
Reply to this comment
by face0 September 29, 2009 6:28 AM PDT
Here is one way to break out (modify the following in iphonenav.js
addEventListener("click", function(event)
{

var link = event.target;
while (link && link.localName.toLowerCase() != "a")
link = link.parentNode;

if (link && link.hash && link.href.indexOf("http://") === -1 )
{
event.preventDefault();
var page = document.getElementById(link.hash.substr(1));
showPage(page);
}
}, true);
Reply to this comment
by minimalLGP September 29, 2009 2:51 PM PDT
This seems to break the internal navigation... Am i doing something wrong?
by VanillaGu October 13, 2009 1:22 PM PDT
This worked for me. Thanks for posting.
by vince1johnson November 4, 2009 11:54 AM PST
In the iphonenav.js just delete line 32 "event.preventDefault();" and save...
Reply to this comment
(6 Comments)
  • prev
  • next

Search iPhone Atlas

advertisement
Click Here

About iPhone Atlas

iPhone Atlas helps you navigate the ins and outs of Apple iPhone ownership with how-tos, troubleshooting information, news, reviews, and more. Got a tip? Want to contact us? E-mail iphoneatlas@cnet.com.

Add this feed to your online news reader

iPhone Atlas topics