<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Dave Ferguson&apos;s Blog - jQuery Mobile</title>
			<link>http://blog.dkferguson.com/index.cfm</link>
			<description>Things I have figured out while learning to type.</description>
			<language>en-us</language>
			<pubDate>Sat, 18 May 2013 16:38:28 -1200</pubDate>
			<lastBuildDate>Fri, 18 Nov 2011 03:56:00 -1200</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>dave@dkferguson.com</managingEditor>
			<webMaster>dave@dkferguson.com</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>dave@dkferguson.com</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			<item>
				<title>jQMobile version 1 and ThemeRoller released</title>
				<link>http://blog.dkferguson.com/index.cfm/2011/11/18/jQMobile-version-1-and-ThemeRoller-released</link>
				<description>
				
				I must have been sleeping under a rock because I missed the release announcement.  

jQuery Mobile version 1 is finally released.  You can read all about it here... &lt;a href=&quot;http://jquerymobile.com/blog/2011/11/16/announcing-jquery-mobile-1-0/&quot;&gt;http://jquerymobile.com/blog/2011/11/16/announcing-jquery-mobile-1-0/&lt;/a&gt;

Congrats to all involved on creating such a great product.


ThemeRoller for jQuery mobile was released as well.  If you were at Adobe MAX 2011 you probably saw it demoed there.  Initially I was very excited about the tool.  However, after 5 minutes with it I was kinda bummed out.  But, take a look at it and form your own opinion... &lt;a href=&quot;http://jquerymobile.com/themeroller/&quot;&gt;http://jquerymobile.com/themeroller/&lt;/a&gt;

Till next time,

--Dave 
				</description>
				
				<category>jQuery Mobile</category>
				
				<pubDate>Fri, 18 Nov 2011 03:56:00 -1200</pubDate>
				<guid>http://blog.dkferguson.com/index.cfm/2011/11/18/jQMobile-version-1-and-ThemeRoller-released</guid>
				
				
			</item>
			
			<item>
				<title>jQuery Mobile Feed Viewer</title>
				<link>http://blog.dkferguson.com/index.cfm/2011/4/5/jQuery-Mobile-Feed-Viewer</link>
				<description>
				
				&lt;p&gt;A little while ago I posted a &lt;a href=&quot;http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content&quot; target=&quot;_blank&quot;&gt;blog&lt;/a&gt; on how to style dynamically loaded content with jQuery Mobile. &#xa0;My goal in that was to create a mobile site that would have a left navigation pane and right side content. &#xa0;It was more of an exploration into what was feasibly possible using JQM. &#xa0;So, I decided to take that knowledge and build something that actually did something. &#xa0;&lt;/p&gt;
&lt;p&gt;In the end I created a mini feed viewer. &#xa0;Using the layout style described above I created a single page viewer all in JQM. &#xa0;There is just one jQuery function in the code to handle the nav clicks. &#xa0;The whole thing is very simplistic but it shows some other interesting ways you can use JQM.&lt;/p&gt;
&lt;p&gt;You can check it out here: &lt;a href=&quot;http://blog.dkferguson.com/demos/feedViewer/index.cfm&quot; target=&quot;_blank&quot;&gt;http://blog.dkferguson.com/demos/feedViewer/index.cfm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;
&lt;p&gt;--Dave&lt;/p&gt; 
				</description>
				
				<category>jQuery Mobile</category>
				
				<pubDate>Tue, 05 Apr 2011 18:56:00 -1200</pubDate>
				<guid>http://blog.dkferguson.com/index.cfm/2011/4/5/jQuery-Mobile-Feed-Viewer</guid>
				
				
			</item>
			
			<item>
				<title>jQuery Mobile; styling loaded content</title>
				<link>http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content</link>
				<description>
				
				&lt;p&gt;With today&apos;s dynamic systems getting them to load properly is always a     challenge.&amp;nbsp; Especially if you have content loaded via Ajax after the     initial load.&amp;nbsp; This can be the hardest part.&amp;nbsp; Even more so, things   like   jQuery Mobile make it even harder.&amp;nbsp; This is because jQuery Mobile     rewrites the html that is initially loaded to be styled and work     properly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, lets take a basic example and figure out how to style some ajax loaded content.&lt;/p&gt;
&lt;p&gt;Lets  look at a basic example of some jQuery Mobile page. Not thing    fancy  here, this just creates a basic page with a header and footer    with some  minor content.&lt;/p&gt;

&lt;code&gt;
&lt;!DOCTYPE html&gt; 
&lt;html&gt; 
	&lt;head&gt; 
	&lt;title&gt;Page Title&lt;/title&gt; 
	&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css&quot; /&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.4.3.min.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt; 
&lt;body&gt; 

&lt;div data-role=&quot;page&quot;&gt;

	&lt;div data-role=&quot;header&quot; &gt;
		&lt;h1&gt;Mail Reader&lt;/h1&gt;
	&lt;/div&gt;&lt;!-- /header --&gt;

	&lt;div data-role=&quot;content&quot;&gt;	
		
		&lt;div class=&quot;ui-grid-a&quot;&gt;
			&lt;div class=&quot;ui-block-a&quot; style=&quot;width: 25%;&apos;&quot;&gt;				
				&lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot;&gt; 
					&lt;li data-role=&quot;list-divider&quot;&gt;My Email&lt;/li&gt; 
					&lt;li&gt;&lt;a href=&quot;test.cfm&quot; id=&quot;LoadInDiv&quot; rel=&quot;external&quot; class=&quot;linkDiv&quot;&gt;Inbox&lt;/a&gt;&lt;/li&gt; 
					&lt;li&gt;&lt;a href=&quot;test2.cfm&quot; id=&quot;LoadInDiv2&quot; rel=&quot;external&quot; class=&quot;linkDiv&quot;&gt;Outbox&lt;/a&gt;&lt;/li&gt; 
					&lt;li data-role=&quot;list-divider&quot;&gt;Other&lt;/li&gt; 
					&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;Feeds&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
			&lt;div class=&quot;ui-block-b&quot; style=&quot;width: 72%; padding-left: 20px;&quot; id=&quot;contentDiv&quot;&gt;
			
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;&lt;!-- /content --&gt;

	&lt;div data-role=&quot;footer&quot;&gt; 
		&lt;div data-role=&quot;navbar&quot;&gt; 
			&lt;ul&gt; 
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Summary&lt;/a&gt;&lt;/li&gt; 
				&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;ui-btn-active&quot;&gt;Favs&lt;/a&gt;&lt;/li&gt; 
				&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Setup&lt;/a&gt;&lt;/li&gt; 
			&lt;/ul&gt; 
		&lt;/div&gt;&lt;!-- /navbar --&gt; 
	&lt;/div&gt;&lt;!-- /footer --&gt;
&lt;/div&gt;&lt;!-- /page --&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/code&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rendered it looks like this:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/jqmdemo_init.png&quot; alt=&quot;&quot; width=&quot;561&quot; height=&quot;221&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So now lets take the base and put a little JavaScript in  to it.&amp;nbsp; This script will handle the click and load some external  content.&lt;/p&gt;
&lt;code&gt;
&lt;script language=&quot;JavaScript&quot;&gt;
$(function(){
	$(&apos;.linkDiv&apos;).click(function(event) {		
		$(&apos;#contentDiv&apos;).load($(this).attr(&apos;href&apos;));
		return false;
	});
});
&lt;/script&gt;	
&lt;/code&gt;
&lt;p&gt;The return from the load call contains this:&lt;/p&gt;
&lt;code&gt;
	&lt;ul data-role=&quot;listview&quot; data-inset=&quot;true&quot; data-theme=&quot;e&quot;&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;12&lt;/span&gt;&lt;/li&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;0&lt;/span&gt;&lt;/li&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;0&lt;/span&gt;&lt;/li&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;0&lt;/span&gt;&lt;/li&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;0&lt;/span&gt;&lt;/li&gt; 
	&lt;li&gt;&lt;a href=&quot;index.html&quot;&gt;This could be a subject&lt;/a&gt; &lt;span class=&quot;ui-li-count&quot;&gt;0&lt;/span&gt;&lt;/li&gt; 
&lt;/ul&gt;
	
&lt;/code&gt;
&lt;p&gt;&lt;strong&gt;When rendered I now get this:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/jqmdemo1_bad.png&quot; alt=&quot;&quot; width=&quot;561&quot; height=&quot;221&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Obviously  this is wrong.&amp;nbsp; The returned content has no styling or any &quot;jQuery  Mobile&quot; magic in it.&amp;nbsp; Even the number is off on the far right.&lt;/p&gt;
&lt;p&gt;This  happens because jQuery Mobile does not know to style the content. It is  not that it can&apos;t, it just doesn&apos;t know it should.&amp;nbsp; The content is  pulled in after the styling has been applied.&amp;nbsp; So, the question is, How  can I get jQuery Mobile to apply its secret sauce to the loaded content?&lt;/p&gt;
&lt;p&gt;Well,  this was no simple task.&amp;nbsp; I tried more things than I can count. Had  many more failures than I would have liked to.&amp;nbsp; At one point I got it to  work fairly easily. However, subsequent loads would break the UI.&amp;nbsp; I  finally ran across a forum entry that I pieced together with other  findings that gave me enough info to create a solution.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The  first thing was not not use load. Load, while a great way to get content  into something was not the right way to go here.&amp;nbsp; What I I needed was  to get the content and store it in a var.&amp;nbsp; Then I had to &quot;coherse&quot;  jQuery Mobile into doing it&apos;s magic.&lt;/p&gt;
&lt;p&gt;So, a simple modification to the JS and I get the magic I am looking for.&lt;/p&gt;
&lt;code&gt;
&lt;script language=&quot;JavaScript&quot;&gt;
	 $(function(){	
		$(&apos;.linkDiv&apos;).click(function(event) {
			$.get($(this).attr(&apos;href&apos;), function(data) {
				$(&apos;#contentDiv&apos;).html(data).page();
				$( &quot;div[data-role=page]&quot; ).page( &quot;destroy&quot; ).page();
			});
			return false;
		});
	});
&lt;/script&gt;	
&lt;/code&gt;
&lt;p&gt;So what is the big change?&amp;nbsp; Well, I replaced the  load with get.&amp;nbsp; This allowed me to store the result in a var.&amp;nbsp; I could  then take that return and put it into the div.&amp;nbsp; Yes, load does that for  me in one line.&amp;nbsp; However, adding the &quot;.page()&quot; to the load chain had no  effect.&amp;nbsp; This way the page() worked. However, to be honest, I have no  idea what the page() function does.&amp;nbsp; I just know it has to be there. The  next part of the magic sauce was the next line.&amp;nbsp; Now just like the page  function, I have no idea what this does either.&amp;nbsp; All I know is that  these two lines of code allow me to produce the result below.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/jqmdemo1_good.png&quot; alt=&quot;&quot; width=&quot;569&quot; height=&quot;272&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Well, there you have it.&amp;nbsp; A few magic beans and BOOM.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;--Dave&lt;/p&gt;



				</description>
				
				<category>jQuery Mobile</category>
				
				<category>jQuery</category>
				
				<pubDate>Tue, 15 Mar 2011 05:03:00 -1200</pubDate>
				<guid>http://blog.dkferguson.com/index.cfm/2011/3/15/jQuery-Mobile-styling-loaded-content</guid>
				
				
			</item>
			</channel></rss>