{"id":13961,"date":"2012-06-14T21:01:01","date_gmt":"2012-06-14T13:01:01","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=13961"},"modified":"2025-04-04T01:06:54","modified_gmt":"2025-04-03T17:06:54","slug":"building-mobile-app-navigation-with-jquery","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/","title":{"rendered":"Building Efficient Mobile Navigation with jQuery"},"content":{"rendered":"<p><a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/smartphones\/\">Smartphones<\/a> now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries like jQuery. Combined with the latest <a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/series-html5-css3-tuts\/\">HTML5\/CSS3<\/a> specifications, it\u2019s possible to build fast and responsive mobile web apps with basic frontend code.<\/p>\n<p>In this tutorial, I\u2019ll show you how to build a <a href=\"https:\/\/www.hongkiat.com\/blog\/build-websites-apps-jquery-mobile\/\">mobile-based<\/a> <a href=\"https:\/\/www.hongkiat.com\/blog\/build-websites-apps-jquery-mobile-custom-themes\/\">website or web app<\/a>. We\u2019ll use CSS3 media queries to target specific devices and screen resolutions. Additionally, we\u2019ll use a bit of <a href=\"https:\/\/www.hongkiat.com\/blog\/tag\/jquery\/\">jQuery<\/a> to animate the menu and load external page content using Ajax calls. Even better, the layout can expand to display correctly in regular desktop browsers such as Chrome or Firefox.<\/p>\n<p><a href=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/demo\/index.html\" class=\"su-button su-button-style-flat\" style=\"color:#FFFFFF;background-color:#2D89EF;border-color:#246ec0;border-radius:0px\" target=\"__blank\" rel=\"noopener nofollow\"><span style=\"color:#FFFFFF;padding:7px 20px;font-size:16px;line-height:24px;border-color:#6cadf4;border-radius:0px;text-shadow:none\"><i class=\"sui sui-external-link\" style=\"font-size:16px;color:#fff\"><\/i>  View demo <\/span><\/a>\n<a href=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/source-codes.zip\" class=\"su-button su-button-style-flat\" style=\"color:#FFFFFF;background-color:#2D89EF;border-color:#246ec0;border-radius:0px\" target=\"__blank\" rel=\"noopener nofollow\"><span style=\"color:#FFFFFF;padding:7px 20px;font-size:16px;line-height:24px;border-color:#6cadf4;border-radius:0px;text-shadow:none\"><i class=\"sui sui-external-link\" style=\"font-size:16px;color:#fff\"><\/i>  Download source<\/span><\/a><\/p>\n<h2>Defining the Page Structure<\/h2>\n<p>Let\u2019s start by reviewing the HTML page structure and applying some CSS rules. We\u2019ll skip most of the unusual meta tags in the header since they don\u2019t directly affect the web app. However, the following meta tags are important:<\/p>\n<pre>\r\n&lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"&gt;\r\n&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\"&gt;\r\n&lt;meta name=\"apple-mobile-web-app-capable\" content=\"yes\"&gt;\r\n&lt;meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\"&gt;\r\n<\/pre>\n<p>The <strong>X-UA-Compatible<\/strong> tag describes how your document should render in certain browsers. It\u2019s particularly interesting when <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.456bereastreet.com\/archive\/201103\/x-ua-compatible_and_html5\/\">coding in HTML5<\/a>, though not essential to worry about too much here. However, the meta <strong>viewport<\/strong> tag is crucial. It sets the mobile browser window to 100% instead of the default zoomed effect.<\/p>\n<p>You can also disable user zoom with the content value <code>user-scalable=no<\/code>. In this case, we just want to set the full-screen width to match the device width. The Apple web app tags enable the website to be saved as a home screen icon on iPhones or iPod Touches. While not necessary, it\u2019s a useful feature to have.<\/p>\n<h3>Inner Body Content<\/h3>\n<p>Inside the body tag, I\u2019ve set up a wrapper div with the ID <code>#w<\/code>. Within this wrapper, I\u2019ve divided the layout into two more divs with IDs <code>#pagebody<\/code> and <code>#navmenu<\/code>. The entire page width is limited to 640px to ensure the layout scales consistently.<\/p>\n<pre>\r\n&lt;div id=\"pagebody\"&gt;\r\n    &lt;header id=\"toolbarnav\"&gt;\r\n        &lt;a href=\"#navmenu\" id=\"menu-btn\"&gt;&lt;\/a&gt;\r\n        &lt;h1&gt;HK Mobile&lt;\/h1&gt;\r\n    &lt;\/header&gt;\r\n\r\n    &lt;section id=\"content\" class=\"clearfix\"&gt;\r\n        &lt;h2&gt;Welcome to the Mobile Site!&lt;\/h2&gt;\r\n    &lt;\/section&gt;\r\n&lt;\/div&gt;\r\n\r\n&lt;div id=\"navmenu\"&gt;\r\n    &lt;header&gt;\r\n        &lt;h1&gt;Menu Links&lt;\/h1&gt;\r\n    &lt;\/header&gt;\r\n\r\n    &lt;ul&gt;\r\n        &lt;li&gt;&lt;a href=\"#homepage.html\" class=\"navlink\"&gt;Home&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a href=\"#about.html\" class=\"navlink\"&gt;About Us&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a href=\"#advertise.html\" class=\"navlink\"&gt;Advertise&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a href=\"#write.html\" class=\"navlink\"&gt;Write for Us&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a href=\"#contacts.html\" class=\"navlink\"&gt;Contacts&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;li&gt;&lt;a href=\"#privacy.html\" class=\"navlink\"&gt;Privacy Policy&lt;\/a&gt;&lt;\/li&gt;\r\n    &lt;\/ul&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<pre>\r\n#w #navmenu {\r\n    background: #475566;\r\n    height: 100%;\r\n    display: block;\r\n    position: fixed;\r\n    width: 300px;\r\n    left: 0px;\r\n    top: 0px;\r\n    z-index: 0;\r\n}\r\n<\/pre>\n<p>This top segment defines styles for both sections of the page. Our nav menu is only 300px wide, leaving some room for the page content to still be visible. The open\/close menu button is located directly on the left side and is always accessible. The important piece here is the z-index property value and using <code>position: fixed;<\/code> on our nav menu.<\/p>\n<p>The top toolbar header is also an interesting section. It is set to a fixed position so it will scroll with the page content. This replicates a similar effect as you\u2019d find in any iOS app title bar.<\/p>\n<pre>\r\n\/** @group header **\/\r\n#w #pagebody header#toolbarnav { \r\n    display: block; \r\n    position: fixed; \r\n    left: 0px; \r\n    top: 0px; \r\n    z-index: 9999; \r\n    background: #0b1851 url('img\/tabbar-solid-bg.png') top left no-repeat; \r\n    border-radius: 5px; \r\n    -moz-border-radius: 5px; \r\n    -webkit-border-radius: 5px; \r\n    -o-border-radius: 5px; \r\n    border-bottom-right-radius: 0; \r\n    -moz-border-radius-bottomright: 0; \r\n    -webkit-border-bottom-right-radius: 0; \r\n    border-bottom-left-radius: 0;\r\n}\r\n<\/pre>\n<p>The navigation menu is given a lower z-index value so that <code>#pagebody<\/code> is always on top. This is crucial since the JavaScript code will slide the page body a certain number of pixels to reveal the navigation underneath.<\/p>\n<p>I\u2019ve used a hash symbol (#) in front of each .html page to stop some poor behavior in Mobile Safari. Whenever you click a link, the URL bar appears and pushes down the content. But when referencing an ID, nothing is reloaded except through JavaScript calls.<\/p>\n<h2>CSS Positioning<\/h2>\n<p>There isn\u2019t much confusing content in our CSS code. Most of the positioning is done manually and then manipulated through jQuery. However, there are a few interesting pieces in our document.<\/p>\n<pre>\r\n\/** @group core body **\/\r\n#w #pagebody {\r\n    -moz-border-radius-bottomleft: 0; \r\n    -webkit-border-bottom-left-radius: 0; \r\n    height: 44px; \r\n    width: 100%; \r\n    max-width: 640px;\r\n}\r\n\r\n#w #pagebody header#toolbarnav h1 { \r\n    text-align: center; \r\n    padding-top: 10px; \r\n    padding-right: 40px; \r\n    color: #e6e8f2; \r\n    font-weight: bold; \r\n    font-size: 2.1em; \r\n    text-shadow: 1px 1px 0px #313131;\r\n}\r\n<\/pre>\n<h3>Mobile Rules<\/h3>\n<p>It\u2019s easy to notice that I\u2019m also using a background image for the blue header bar texture. This image is sized at 640\u00d744 pixels to maintain the consistent layout structure. Additionally, I\u2019ve created an image @2x for iPhone\/iPad retina displays. You can see both images below or grab them from my demo source code:<\/p>\n<ul>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/demo\/img\/tabbar-solid-bg.png\">Tabbar Solid BG<\/a><\/li>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/demo\/img\/tabbar-solid-bg@2x.png\">Tabbar Solid BG @2x<\/a><\/li>\n<\/ul>\n<p>I set up the mobile CSS for this functionality in another file named <strong>responsive.css<\/strong>. It contains two media queries which replace the title bar background and the menu button icon for retina devices.<\/p>\n<pre>\r\n\/** retina display **\/\r\n@media only screen and (-webkit-min-device-pixel-ratio: 2), \r\n       only screen and (min--moz-device-pixel-ratio: 1.5),\r\n       only screen and (min-device-pixel-ratio: 1.5) {\r\n    #w #pagebody header {\r\n        background: #0b1851 url('img\/tabbar-solid-bg@2x.png') top left no-repeat;\r\n        background-size: 640px 44px;\r\n    }\r\n    #w #pagebody header #menu-btn {\r\n        background: url('img\/nav-btn@2x.png') no-repeat;\r\n        background-size: 53px 30px;\r\n    }\r\n}\r\n<\/pre>\n<h3>Designing Menu Arrows<\/h3>\n<p>In the navigation area, I\u2019ve also included a small arrow icon on the right side of each menu link. This can easily be replaced with an image from any <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.iconfinder.com\/\">creative commons artwork<\/a>. However, most CSS3 enthusiasts will enjoy testing out this method.<\/p>\n<pre>\r\n#w #navmenu ul li a::after {\r\n    content: '';\r\n    display: block;\r\n    width: 6px;\r\n    height: 6px;\r\n    border-right: 3px solid #d0d0d8;\r\n    border-top: 3px solid #d0d0d8;\r\n    position: absolute;\r\n    right: 30px;\r\n    top: 45%;\r\n    -webkit-transform: rotate(45deg);\r\n    -moz-transform: rotate(45deg);\r\n    -o-transform: rotate(45deg);\r\n    transform: rotate(45deg);\r\n}\r\n\r\n#w #navmenu ul li a:hover::after { \r\n    border-color: #cad0e6; \r\n}\r\n<\/pre>\n<p>We are using the <code>transform<\/code> property to create a small border after the content. Additionally, <code>position: absolute;<\/code> is used to freely move these borders around the inner link item. Changing the border color on hover offers a more dynamic feel. It\u2019s incredible what you can achieve with basic HTML5 and CSS3 rules.<\/p>\n<p>Now, let\u2019s delve into the JavaScript code. Remember, this requires including the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/jquery.com\/\">jQuery library<\/a> for the code to run properly.<\/p>\n<h2>jQuery Animation<\/h2>\n<p>In writing these custom codes, I\u2019ve created a new document named <strong>script.js<\/strong>. You can write these directly in <code>&lt;script&gt;<\/code> tags, or download my example from the demo source code.<\/p>\n<pre>\r\n$(document).ready(function() {\r\n    var pagebody = $(\"#pagebody\");\r\n    var themenu = $(\"#navmenu\");\r\n    var topbar = $(\"#toolbarnav\");\r\n    var content = $(\"#content\");\r\n    var viewport = {\r\n        width: $(window).width(),\r\n        height: $(window).height()\r\n    };\r\n    \/\/ retrieve variables as \r\n    \/\/ viewport.width \/ viewport.height\r\n});\r\n<\/pre>\n<p>To begin, I\u2019ve set up some page variables to reference elements in the document more quickly. The viewport value is not used here, but it can be useful if you want to adjust the animation stages. For example, you can check the current browser width and adjust your menu accordingly.<\/p>\n<pre>\r\nfunction openme() { \r\n    $(function() {\r\n        topbar.animate({\r\n            left: \"290\"\r\n        }, { duration: 300, queue: false });\r\n        pagebody.animate({\r\n            left: \"290\"\r\n        }, { duration: 300, queue: false });\r\n    });\r\n}\r\n\r\nfunction closeme() {\r\n    $(function() {\r\n        topbar.animate({\r\n            left: \"0\"\r\n        }, { duration: 180, queue: false });\r\n        pagebody.animate({\r\n            left: \"0\"\r\n        }, { duration: 180, queue: false });\r\n    });\r\n}\r\n<\/pre>\n<p>Next, I\u2019ve defined two important functions for opening and closing the menu. These could have been done in a single function with a callback toggle; however, we need to animate two distinct elements simultaneously. Unfortunately, this isn\u2019t the default behavior in jQuery, so we need to use an alternative syntax.<\/p>\n<p>The two elements we\u2019re targeting are named <strong>topbar<\/strong> and <strong>pagebody<\/strong>. The inner content area with a white background is the full pagebody; however, the title bar is fixed at the top of the page. This means it won\u2019t naturally animate with the page, so we need to use a separate call. The opening function pushes the elements 290px left (almost the full 300px nav width), and the closing function retracts them.<\/p>\n<h2>Loading Dynamic Content<\/h2>\n<p>The code above easily handles the animation. Theoretically, that\u2019s all you need for such a simple mobile website. However, I want to add a bit more functionality.<\/p>\n<p>Each time the user clicks on a menu link, we want to close the current navigation and display a loading gif while we fetch the page content. Once completed, we remove the gif image and load the new content inside. This approach is fantastic because we can use static .html pages for the content, avoiding the complexity of backend languages like PHP, Ruby, or Perl.<\/p>\n<h3>Managing Clicks<\/h3>\n<p>First, we need to detect when users click on the navigation buttons. This will prevent the default href value from loading, allowing us to use our functions to display external content.<\/p>\n<pre>\r\n\/\/ loading page content for navigation\r\n$(\"a.navlink\").live(\"click\", function(e) {\r\n    e.preventDefault();\r\n    var linkurl = $(this).attr(\"href\");\r\n    var linkhtmlurl = linkurl.substring(1, linkurl.length);\r\n    \r\n    var imgloader = '&lt;center style=\"margin-top: 30px;\"&gt;&lt;img src=\"img\/preloader.gif\" alt=\"loading...\"\/&gt;&lt;\/center&gt;';\r\n});\r\n<\/pre>\n<p>We are opening a selector for any anchor with the class <code>navlink<\/code>. Whenever a user clicks one of these links, we stop it from loading and set up a variable for the full URL. I\u2019ve also set up a variable for the content HTML to include a standard image loader.<\/p>\n<h3>Ajax .load()<\/h3>\n<p>There are two different parts to this effect, which I\u2019ve neatly separated. The code below closes the navigation menu and slides the document window to the top. We replace the inner body content with a small loader animation, which users can\u2019t see if they are at the bottom of the page.<\/p>\n<pre>\r\ncloseme();\r\n\r\n$(function() {\r\n    topbar.css(\"top\", \"0\");\r\n    window.scrollTo(0, 1);\r\n});\r\n<\/pre>\n<p>Finally, we want to replace the inner body content with our image and fetch the external page to load. Normally, this takes a couple of hundred milliseconds or less, so I\u2019ve set a timeout function.<\/p>\n<pre>\r\ncontent.html(imgloader);\r\n\r\nsetTimeout(function() {\r\n    content.load(linkhtmlurl, function() {\r\n        \/\/ callback\r\n    });\r\n}, 1200);\r\n<\/pre>\n<p>This pauses for 1200 milliseconds before loading new content. For my demo, this delay looks better and gives an idea of how the application would behave on slower Internet connections.<\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/demo\/index.html\"><img decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\" alt=\"Mobile web app HTML5\/CSS3\/jQuery tutorial - live demo\"><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>I encourage all web developers to download the tutorial source code and experiment on their own. This is a basic example of what can be accomplished with HTML\/CSS3 and a touch of JavaScript effects. Building for mobile screens is easier than ever with media queries and more extensible web browsers.<\/p>\n<p>Try to apply some of this code in your future web projects. Building mobile applications is an art, much like web design, and requires dedication and practice. I hope this tutorial serves as a good starting point for a few enthusiastic developers. If you have questions or thoughts about the code, feel free to share them in the post-discussion area.<\/p>","protected":false},"excerpt":{"rendered":"<p>Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries like jQuery. Combined with the latest HTML5\/CSS3 specifications, it\u2019s possible to build fast and responsive mobile web apps with basic frontend code. In this tutorial, I\u2019ll show you how to&hellip;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[911],"topic":[4520,4521],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Building Efficient Mobile Navigation with jQuery - Hongkiat<\/title>\n<meta name=\"description\" content=\"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building Efficient Mobile Navigation with jQuery\" \/>\n<meta property=\"og:description\" content=\"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-14T13:01:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T17:06:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\" \/>\n<meta name=\"author\" content=\"Jake Rocheleau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jake Rocheleau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/\"},\"author\":{\"name\":\"Jake Rocheleau\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\"},\"headline\":\"Building Efficient Mobile Navigation with jQuery\",\"datePublished\":\"2012-06-14T13:01:01+00:00\",\"dateModified\":\"2025-04-03T17:06:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/\"},\"wordCount\":1434,\"commentCount\":58,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mobile-navi-with-jquery\\\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\",\"keywords\":[\"jQuery\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/\",\"name\":\"Building Efficient Mobile Navigation with jQuery - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mobile-navi-with-jquery\\\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\",\"datePublished\":\"2012-06-14T13:01:01+00:00\",\"dateModified\":\"2025-04-03T17:06:54+00:00\",\"description\":\"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mobile-navi-with-jquery\\\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/mobile-navi-with-jquery\\\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/building-mobile-app-navigation-with-jquery\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Efficient Mobile Navigation with jQuery\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\",\"name\":\"Jake Rocheleau\",\"description\":\"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/jake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Building Efficient Mobile Navigation with jQuery - Hongkiat","description":"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/","og_locale":"en_US","og_type":"article","og_title":"Building Efficient Mobile Navigation with jQuery","og_description":"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries","og_url":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2012-06-14T13:01:01+00:00","article_modified_time":"2025-04-03T17:06:54+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg","type":"","width":"","height":""}],"author":"Jake Rocheleau","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Jake Rocheleau","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/"},"author":{"name":"Jake Rocheleau","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a"},"headline":"Building Efficient Mobile Navigation with jQuery","datePublished":"2012-06-14T13:01:01+00:00","dateModified":"2025-04-03T17:06:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/"},"wordCount":1434,"commentCount":58,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg","keywords":["jQuery"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/","url":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/","name":"Building Efficient Mobile Navigation with jQuery - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg","datePublished":"2012-06-14T13:01:01+00:00","dateModified":"2025-04-03T17:06:54+00:00","description":"Smartphones now come with highly efficient web browsers. JavaScript has become more powerful than ever and can be extended with the help of code libraries","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/mobile-navi-with-jquery\/hongkiat-mobile-jquery-webapp-tutorial-demo.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/building-mobile-app-navigation-with-jquery\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Building Efficient Mobile Navigation with jQuery"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a","name":"Jake Rocheleau","description":"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/jake\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-3Db","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/13961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=13961"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/13961\/revisions"}],"predecessor-version":[{"id":73521,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/13961\/revisions\/73521"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=13961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=13961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=13961"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=13961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}