Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Mobile navigaton
    primarykey
    data
    text
    <p>I'm trying to create a mobile version of my views using jQuery Mobile, but it doesn't work like expected.</p> <p>I have two pages - a.html has one jQuery Mobile page (<code>div</code> with <code>data-role="page"</code>) and a link to b.html which has several jQuery Mobile pages. Now if I load a.html in my browser I can go to b.html and display the main "page", but any links inside b.html referring to other "page" divs inside b.html will fail (this are the hash links with <code>href</code> like <code>#otherpage</code>). If I go straight to b.html all links work perfectly.</p> <p>Is it possible to serve several "page" divs in b.html without breaking the navigation controls?</p> <p>I'm using latest jQuery Mobile 1.0 alpha 4.1.</p> <p>UPDATE</p> <p>Framework I'm using is Ruby on Rails.</p> <p>Part of my mobile layout:</p> <pre><code>&lt;div data-role="page"&gt; &lt;div data-role="content"&gt; &lt;%= yield %&gt; &lt;/div&gt; &lt;/div&gt; &lt;%= yield :pages %&gt; </code></pre> <p>Page a.html - that is an index action of a Rails scaffold:</p> <pre><code>&lt;ul data-role="listview"&gt; &lt;% @tv_series.each do |tv_series| %&gt; &lt;li&gt;&lt;%= link_to tv_series.title, tv_series %&gt;&lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; </code></pre> <p>Page b.html - this are show actions of the same Rails scaffold:</p> <pre><code>&lt;ul data-role="listview"&gt; &lt;% @seasons.each do |season| %&gt; &lt;li&gt; &lt;!-- this are the links that work only if base page was b.html --&gt; &lt;a href="#season&lt;%= season.id %&gt;"&gt;Season &lt;%= season.number %&gt;&lt;/a&gt; &lt;/li&gt; &lt;%= render :partial =&gt; 'seasons/season.html.erb', :locals =&gt; { :season =&gt; season } %&gt; &lt;% end %&gt; &lt;/ul&gt; </code></pre> <p>The season partial generates a new page div:</p> <pre><code>&lt;% content_for :pages do %&gt; &lt;div data-role="page" id="season&lt;%= season.id %&gt;"&gt; &lt;div data-role="content"&gt; whatever &lt;/div&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre> <p>Now the error I get: if I go to scaffold index (<code>/tv_series</code>) and select one item, I go to show page with URL <code>/tv_series#/tv_series/:id</code> - the links I get on this page look like <code>/tv_series/tv_series/:id#season134</code> which is obviously wrong, jQuery Mobile tries an AJAX request and fails with page not found. If I go to <code>/tv_series/:id</code> manually all the links look fine (<code>/tv_series/:id#season134</code>).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload