{"id":781,"date":"2013-01-08T16:27:32","date_gmt":"2013-01-08T16:27:32","guid":{"rendered":"https:\/\/ibex.tech\/javascript\/?p=781"},"modified":"2022-02-17T07:14:47","modified_gmt":"2022-02-17T07:14:47","slug":"navigation-between-pages","status":"publish","type":"post","link":"https:\/\/ibex.tech\/javascript\/jquery-mobile\/links-jquery-mobile\/navigation-between-pages","title":{"rendered":"Navigation Between Pages"},"content":{"rendered":"<p>\nLinking between jQuery Mobile pages creates a transition animation between pages on compatible devices (e.g. iOS &amp; Android). If running on a browserthe browser&rsquo;s back button (which may be a hardware back button on some devices such as android) will go back to the first page.\n<\/p>\n<p>\n&nbsp;\n<\/p>\n<h4>\nBack Button In Header<br \/>\n<\/h4>\n<p>\nUse this in the page data-role:\n<\/p>\n<pre>\r\n<code>\r\n&lt;div data-role=&quot;page&quot; data-add-back-btn=&quot;true&quot; data-back-btn-text=&quot;Previous&quot; data-back-btn-theme=&quot;e&quot; &gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<h4>\nAddress Bar Appearing When Navigating<br \/>\n<\/h4>\n<p>\nWhen the user navigates to another page the address bar may appear for a second and then hide again. This only happens with browser based webapps and can be avoided by using a full-screen webapp or a hybrid native app.\n<\/p>\n<h4>\nLinking To Another Page In The Same Document<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n&lt;a href=&quot;#id_of_the_page&quot;&gt;\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<h4>\nLinking To Another Page File On The Same Domain<br \/>\n<\/h4>\n<p>\nUse a normal href link to the html or php&nbsp;file. &nbsp;jQuery Mobile will actually use AJAX to make the request to the other document and show a spinner while it gets it.\n<\/p>\n<p>\nThe destination page must be a 1 page document.\n<\/p>\n<p>\nThe framework takes only the first page (the first div with role=&quot;page&quot;) from the loaded document and discards any other content. So any information you add to the &lt;head&gt; of the target document will be ignored, with any other content outside the first page element. That means any CSS or JavaScript embedded in other documents and the title element will be ignored. If you want to support non jQuery browser this content shouldn&#39;t be removed as it will be used by them following the link as a normal web link, but as far as jQuery is concerned it doesn&#39;t exist.\n<\/p>\n<h4>\nNon jQuery&nbsp;Links (Absolute External Links)<br \/>\n<\/h4>\n<p>\nTo link to another site or document that does not have jQuery Mobile content add data-rel=&quot;external&quot; to the a tag. E.g.:\n<\/p>\n<pre>\r\n<code>\r\n&lt;a href=&quot;http:\/\/www.somedomain.com&quot; data-rel=&quot;external&quot;&gt;\r\n<\/code><\/pre>\n<p>\ntarget=&quot;_blank&quot; &gt; will also do the same thing.\n<\/p>\n<p>\n&nbsp;\n<\/p>\n<h4>\nTransitions Between Pages<br \/>\n<\/h4>\n<p>\nBy default all the transitions between pages use the right-to-left animation.&nbsp;To change or to explicitly define which animation transition we want in every page change use data-transition inside the link.\n<\/p>\n<p style=\"margin-left: 40px;\">\nslide &#8211; The default right-to-left animation<br \/>\nslideup &#8211; Bottom-to-top animation (mostly used for modal pages)<br \/>\nslidedown &#8211; Top-to-bottom animation<br \/>\npop &#8211; The new page grows from a small point in the middle to a full-screen page<br \/>\nfade &#8211; A cross-fade animation between old and new pages<br \/>\nflip &#8211; A 2D or 3D rotation animation (3D is available only on some devices such as iOS devices. On other devices such as Android this transition renders a 2D less cool rotation).\n<\/p>\n<pre>\r\n<code>\r\n&lt;a href=&quot;#page2&quot; data-transition=&quot;fade&quot;&gt;Next page&lt;\/a&gt;\r\n<\/code><\/pre>\n<p>\nIf you want to force a reverse transition (back action) you can specify data-direction=&quot;reverse&quot; on the link to cause jQuery Mobile to make the transition in reverse.\n<\/p>\n<p>\n&nbsp;\n<\/p>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linking between jQuery Mobile pages creates a transition animation between pages on compatible devices (e.g. iOS &amp; Android). If running on a browserthe browser&rsquo;s back button (which may be a hardware back button on some devices such as android) will go back to the first page. &nbsp; Back Button In Header Use this in the [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[87],"tags":[],"class_list":["post-781","post","type-post","status-publish","format-standard","hentry","category-links-jquery-mobile"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/comments?post=781"}],"version-history":[{"count":13,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/781\/revisions"}],"predecessor-version":[{"id":797,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/781\/revisions\/797"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/media?parent=781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/categories?post=781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/tags?post=781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}