<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>RRPowered</title>
	
	<link>http://www.rrpowered.com</link>
	<description />
	<lastBuildDate>Wed, 22 Feb 2012 04:06:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/rrpowereds" /><feedburner:info uri="rrpowereds" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>rrpowereds</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/rrpowereds" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Frrpowereds" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Use jQuery to load external files</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/YZAQHeK-X-Y/</link>
		<comments>http://www.rrpowered.com/2012/02/use-jquery-to-load-external-files/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 04:05:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Load External File]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=534</guid>
		<description><![CDATA[I’m going to show you an easy way to load a external file using jQuery and use a loading image while file loads. &#160; Demo lets go!!!. We are gonna use the jQuery .load() function to load are external page. &#8230; <a href="http://www.rrpowered.com/2012/02/use-jquery-to-load-external-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>I’m going to show you an easy way to load a external file using jQuery and use a loading image while file loads.</h5>
<p><a href="http://www.rrpowered.com/2012/02/use-jquery-to-load-external-files/" class="image-post"><img src="http://www.rrpowered.com/images/ex.gif" alt="" class="post-img" /></a><br />
<span id="more-534"></span><br />
&nbsp;<br />
<a href="http://www.rrpowered.com/demo/loadex" alt="img" class="demo">Demo</a><br />
<b>lets go!!!.</b><br />
We are gonna use the jQuery <b>.load()</b> function to load are external page.<br />
The code below will load the <b>external.html</b> file into a div with the class of <b>.loaded_files</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre>$(&quot;.loaded_files&quot;).load(&#039;external.html&#039;);</pre>
</div>
<p><b>We&#8217;re all done!</b><br />
Now that we know how it works, let&#8217;s put it all together.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered.com --&gt;</span>
<span class="html-comment">&lt;!-- File name index.html --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.1//EN&quot;</span>
<span class="html-attribute">&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html&gt;</span>
	<span class="html-other-element">&lt;head&gt;</span>
		<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/ajax/
		libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
		<span class="html-other-element">&lt;title&gt;</span>Load external files with jQuery Demo<span class="html-other-element">&lt;/title&gt;</span>
		<span class="html-style-element">&lt;style type=<span class="css-string">&quot;text/css&quot;</span>&gt;<span class="css"><span class="css">
			.load_files {
				<span class="css-property">padding<span class="css-selector">:</span><span class="css-value"> 5px</span></span>;
				<span class="css-property">font-weight<span class="css-selector">:</span><span class="css-value"> bold</span></span>;
				<span class="css-property">background-color<span class="css-selector">:</span><span class="css-value"> #A9F5A9</span></span>;
				<span class="css-property">border<span class="css-selector">:</span><span class="css-value"> solid #333333 1px</span></span>;
				<span class="css-property">cursor<span class="css-selector">:</span><span class="css-value"> pointer</span></span>;
			}
			<span class="css-comment">/* The loading image */</span>
			.loading {
				<span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 20px</span></span>;
				<span class="css-property">height<span class="css-selector">:</span><span class="css-value"> 20px</span></span>;
				<span class="css-property">background-image<span class="css-selector">:</span><span class="css-value"> url(<span class="css-string">'loader.gif'</span>)</span></span>;
				<span class="css-property">display<span class="css-selector">:</span><span class="css-value"> none</span></span>;
			}

		</span></span>&lt;/style&gt;</span>
		<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
			$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
				$<span class="js-bracket">(</span><span class="js-string">&quot;.load_files&quot;</span><span class="js-bracket">)</span>.<span class="js-client-keyword">click</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
					$<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.hide<span class="js-bracket">(</span><span class="js-bracket">)</span>;
					<span class="js-comment">/* When load files button is clicked hide it */</span>
					$<span class="js-bracket">(</span><span class="js-string">&quot;.loading&quot;</span><span class="js-bracket">)</span>.show<span class="js-bracket">(</span><span class="js-bracket">)</span>;
					<span class="js-comment">/* Show loading image */</span>
					<span class="js-comment">/* Load the external file */</span>
					$<span class="js-bracket">(</span><span class="js-string">&quot;.loaded_files&quot;</span><span class="js-bracket">)</span>.<span class="js-client-keyword">load</span><span class="js-bracket">(</span><span class="js-string">'external.html'</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
						$<span class="js-bracket">(</span><span class="js-string">&quot;.loading&quot;</span><span class="js-bracket">)</span>.hide<span class="js-bracket">(</span><span class="js-bracket">)</span>;
						<span class="js-comment">/* Hide loading image when external file is loaded */</span>
					<span class="js-bracket">}</span><span class="js-bracket">)</span>;
				<span class="js-bracket">}</span><span class="js-bracket">)</span>;
			<span class="js-bracket">}</span><span class="js-bracket">)</span>;

		</span></span>&lt;/script&gt;</span>
	<span class="html-other-element">&lt;/head&gt;</span>
	<span class="html-other-element">&lt;body&gt;</span>
		<span class="html-other-element">&lt;h2&gt;</span>Load external files with jQuery<span class="html-other-element">&lt;/h2&gt;</span>
		<span class="html-form-element">&lt;button class=<span class="html-attribute">&quot;load_files&quot;</span>&gt;</span>
			Load Files
		<span class="html-form-element">&lt;/button&gt;</span>
		<span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;loading&quot;</span>&gt;</span><span class="html-other-element">&lt;/div&gt;</span>
		<span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;loaded_files&quot;</span>&gt;</span><span class="html-other-element">&lt;/div&gt;</span>
	<span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p><b>Now for the external file.</b><br />
external.html</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="html"><span class="html-other-element">&lt;p&gt;</span>External File Loaded With jQuery<span class="html-other-element">&lt;/p&gt;</span></span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/hPFuPFg9gcaXuVwkonInTtUSR7s/0/da"><img src="http://feedads.g.doubleclick.net/~a/hPFuPFg9gcaXuVwkonInTtUSR7s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hPFuPFg9gcaXuVwkonInTtUSR7s/1/da"><img src="http://feedads.g.doubleclick.net/~a/hPFuPFg9gcaXuVwkonInTtUSR7s/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/YZAQHeK-X-Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/02/use-jquery-to-load-external-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/02/use-jquery-to-load-external-files/</feedburner:origLink></item>
		<item>
		<title>jQuery simple image slide</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/g4VXjGW_8zU/</link>
		<comments>http://www.rrpowered.com/2012/02/jquery-simple-image-slide/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 03:48:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Image Slide]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=514</guid>
		<description><![CDATA[A simple jQuery image slide for use on you website or blog. &#160; Demo lets get started. Here is the javascript. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 &#8230; <a href="http://www.rrpowered.com/2012/02/jquery-simple-image-slide/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>A simple jQuery image slide for use on you website or blog.</h5>
<p><a href="http://www.rrpowered.com/2012/02/jquery-simple-image-slide/" class="image-post"><img src="http://www.rrpowered.com/images/imageslide.gif" alt="" class="post-img" /></a><br />
<span id="more-514"></span><br />
&nbsp;<br />
<a href="http://www.rrpowered.com/demo/imageslide" alt="img" class="demo">Demo</a><br />
<b>lets get started.</b><br />
Here is the javascript. </p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
    	<span class="js-native-keyword">setInterval</span><span class="js-bracket">(</span><span class="js-string">&quot;slide()&quot;</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
    	<span class="js-comment">//Time is in milliseconds 5000ms is equivalent to 5sec
</span>
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
    <span class="js-comment">//Call the slide function
</span>
    <span class="js-function-keyword">function</span> slide<span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>

    	<span class="js-reserved-keyword">var</span> act <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#slide img.active&quot;</span><span class="js-bracket">)</span>;
    	<span class="js-comment">//Get the current active image
</span>

    	<span class="js-reserved-keyword">var</span> img_src <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#slide img.active&quot;</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;src&quot;</span><span class="js-bracket">)</span>;
    	<span class="js-comment">//Get the image path
</span>

    	<span class="js-reserved-keyword">if</span><span class="js-bracket">(</span>act.length <span class="js-operator">=</span><span class="js-operator">=</span> <span class="js-number">0</span><span class="js-bracket">)</span>
    		act <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">'#slide img:last'</span><span class="js-bracket">)</span>;
    	<span class="js-comment">//If active equals 0 set act to last img
</span>

    	<span class="js-reserved-keyword">var</span> nex <span class="js-operator">=</span> act.next<span class="js-bracket">(</span><span class="js-bracket">)</span>.length <span class="js-operator">?</span> act.next<span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-operator">:</span> $<span class="js-bracket">(</span><span class="js-string">'#slide img:first'</span><span class="js-bracket">)</span>;
    	<span class="js-comment">/*If next active
    	 image equals 0 go to first image  if not go to next image */</span>

    	nex.addClass<span class="js-bracket">(</span><span class="js-string">'active'</span><span class="js-bracket">)</span>;
    	<span class="js-comment">//Set the class active to image
</span>

    	$<span class="js-bracket">(</span><span class="js-string">&quot;.append_image&quot;</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
    		opacity <span class="js-operator">:</span> <span class="js-number">0</span>.<span class="js-number">0</span><span class="js-number">5</span>
    	<span class="js-bracket">}</span>, <span class="js-number">1</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span><span class="js-comment">//Fade old image out
</span>
    		$<span class="js-bracket">(</span><span class="js-string">&quot;.append_image&quot;</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;src&quot;</span>, <span class="js-string">&quot;&quot;</span> <span class="js-operator">+</span> img_src<span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
    			opacity <span class="js-operator">:</span> <span class="js-number">1</span>.<span class="js-number">0</span>
    		<span class="js-bracket">}</span>, <span class="js-number">1</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span><span class="js-comment">//Fade new image in
</span>
    			act.removeClass<span class="js-bracket">(</span><span class="js-string">'active last-active'</span><span class="js-bracket">)</span>;
    			<span class="js-comment">//Remove classes &quot;active&quot; and &quot;last-active&quot;
</span>
    		<span class="js-bracket">}</span><span class="js-bracket">)</span>;
    	<span class="js-bracket">}</span><span class="js-bracket">)</span>;
    <span class="js-bracket">}</span></span></pre>
</div>
<p><b>The HTML</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre>
<pre><span class="html"><span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;frame&quot;</span>&gt;</span>
	<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imaged.png&quot;</span> alt=<span class="html-attribute">&quot;d&quot;</span> class=<span class="html-attribute">&quot;append_image&quot;</span>&gt;</span>
<span class="html-other-element">&lt;/div&gt;</span>
<span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;slide&quot;</span>&gt;</span>
	<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imagea.png&quot;</span> alt=<span class="html-attribute">&quot;a&quot;</span> class=<span class="html-attribute">&quot;active&quot;</span>&gt;</span>
	<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imageb.png&quot;</span> alt=<span class="html-attribute">&quot;b&quot;</span>&gt;</span>
	<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imagec.png&quot;</span> alt=<span class="html-attribute">&quot;c&quot;</span>&gt;</span>
	<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imaged.png&quot;</span> alt=<span class="html-attribute">&quot;d&quot;</span>&gt;</span>
<span class="html-other-element">&lt;/div&gt;</span></span></pre>
</div>
<p><b>Now put the whole code together!</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered.com --&gt;</span>
<span class="html-comment">&lt;!-- File name index.html --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.1//EN&quot;</span>
<span class="html-attribute">&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html&gt;</span>
	<span class="html-other-element">&lt;head&gt;</span>
		<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/ajax/
		libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
		<span class="html-other-element">&lt;title&gt;</span>A simple jQuery image slide<span class="html-other-element">&lt;/title&gt;</span>
		<span class="html-style-element">&lt;style type=<span class="css-string">&quot;text/css&quot;</span>&gt;<span class="css"><span class="css">
			body {
				<span class="css-property">margin<span class="css-selector">:</span><span class="css-value"> 200px 0 0 400px</span></span>;
				<span class="css-property">font-family<span class="css-selector">:</span><span class="css-value"> <span class="css-string">&quot;arial&quot;</span></span></span>;
			}
			#slide {
				<span class="css-property">display<span class="css-selector">:</span><span class="css-value"> none</span></span>;
			}
			#frame {
				<span class="css-property">height<span class="css-selector">:</span><span class="css-value"> 104px</span></span>;
				<span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 420px</span></span>;
				<span class="css-property">padding<span class="css-selector">:</span><span class="css-value"> 10px</span></span>;
				<span class="css-property">border<span class="css-selector">:</span><span class="css-value"> solid #808080 2px</span></span>;
			}
		</span></span>&lt;/style&gt;</span>
		<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
			$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
				<span class="js-native-keyword">setInterval</span><span class="js-bracket">(</span><span class="js-string">&quot;slide()&quot;</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
				<span class="js-comment">//Time is in milliseconds 5000ms is equivalent to 5sec
</span>
			<span class="js-bracket">}</span><span class="js-bracket">)</span>;
			<span class="js-comment">//Call the slide function
</span>
			<span class="js-function-keyword">function</span> slide<span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>

				<span class="js-reserved-keyword">var</span> act <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#slide img.active&quot;</span><span class="js-bracket">)</span>;
				<span class="js-comment">//Get the current active image
</span>

				<span class="js-reserved-keyword">var</span> img_src <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#slide img.active&quot;</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;src&quot;</span><span class="js-bracket">)</span>;
				<span class="js-comment">//Get the image path
</span>

				<span class="js-reserved-keyword">if</span><span class="js-bracket">(</span>act.length <span class="js-operator">=</span><span class="js-operator">=</span> <span class="js-number">0</span><span class="js-bracket">)</span>
					act <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">'#slide img:last'</span><span class="js-bracket">)</span>;
				<span class="js-comment">//If active equals 0 set act to last img
</span>

				<span class="js-reserved-keyword">var</span> nex <span class="js-operator">=</span> act.next<span class="js-bracket">(</span><span class="js-bracket">)</span>.length <span class="js-operator">?</span> act.next<span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-operator">:</span> $<span class="js-bracket">(</span><span class="js-string">'#slide img:first'</span><span class="js-bracket">)</span>;
				<span class="js-comment">/*If next active
				 image equals 0 go to first image  if not go to next image */</span>

				nex.addClass<span class="js-bracket">(</span><span class="js-string">'active'</span><span class="js-bracket">)</span>;
				<span class="js-comment">//Set the class active to image
</span>

				$<span class="js-bracket">(</span><span class="js-string">&quot;.append_image&quot;</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
					opacity <span class="js-operator">:</span> <span class="js-number">0</span>.<span class="js-number">0</span><span class="js-number">5</span>
				<span class="js-bracket">}</span>, <span class="js-number">1</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span><span class="js-comment">//Fade old image out
</span>
					$<span class="js-bracket">(</span><span class="js-string">&quot;.append_image&quot;</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;src&quot;</span>, <span class="js-string">&quot;&quot;</span> <span class="js-operator">+</span> img_src<span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
						opacity <span class="js-operator">:</span> <span class="js-number">1</span>.<span class="js-number">0</span>
					<span class="js-bracket">}</span>, <span class="js-number">1</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span><span class="js-comment">//Fade new image in
</span>
						act.removeClass<span class="js-bracket">(</span><span class="js-string">'active last-active'</span><span class="js-bracket">)</span>;
						<span class="js-comment">//Remove classes &quot;active&quot; and &quot;last-active&quot;
</span>
					<span class="js-bracket">}</span><span class="js-bracket">)</span>;
				<span class="js-bracket">}</span><span class="js-bracket">)</span>;
			<span class="js-bracket">}</span>
		</span></span>&lt;/script&gt;</span>
	<span class="html-other-element">&lt;/head&gt;</span>
	<span class="html-other-element">&lt;body&gt;</span>
		<span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;frame&quot;</span>&gt;</span>
			<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imaged.png&quot;</span> alt=<span class="html-attribute">&quot;d&quot;</span> class=<span class="html-attribute">&quot;append_image&quot;</span>&gt;</span>
		<span class="html-other-element">&lt;/div&gt;</span>
		<span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;slide&quot;</span>&gt;</span>
			<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imagea.png&quot;</span> alt=<span class="html-attribute">&quot;a&quot;</span> class=<span class="html-attribute">&quot;active&quot;</span>&gt;</span>
			<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imageb.png&quot;</span> alt=<span class="html-attribute">&quot;b&quot;</span>&gt;</span>
			<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imagec.png&quot;</span> alt=<span class="html-attribute">&quot;c&quot;</span>&gt;</span>
			<span class="html-image-element">&lt;img src=<span class="html-attribute">&quot;imaged.png&quot;</span> alt=<span class="html-attribute">&quot;d&quot;</span>&gt;</span>
		<span class="html-other-element">&lt;/div&gt;</span>
	<span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/h0jnuHTOnAWBsBxulZfrBNGHzs4/0/da"><img src="http://feedads.g.doubleclick.net/~a/h0jnuHTOnAWBsBxulZfrBNGHzs4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/h0jnuHTOnAWBsBxulZfrBNGHzs4/1/da"><img src="http://feedads.g.doubleclick.net/~a/h0jnuHTOnAWBsBxulZfrBNGHzs4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/g4VXjGW_8zU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/02/jquery-simple-image-slide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/02/jquery-simple-image-slide/</feedburner:origLink></item>
		<item>
		<title>jQuery Growing Menu</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/fSPYO7vaHAk/</link>
		<comments>http://www.rrpowered.com/2012/02/jquery-growing-menu/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 05:44:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Animated]]></category>
		<category><![CDATA[Growing]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Menu]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=498</guid>
		<description><![CDATA[Today We are gonna make a horizontal expanding menu using jQuery and css. &#160; Demo Let&#8217;s start with the jQuery. When the menu gets moused over we will animate and show the hidden text. On mouseout will will hide the &#8230; <a href="http://www.rrpowered.com/2012/02/jquery-growing-menu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Today We are gonna make a horizontal expanding menu using jQuery and css.</h5>
<p><a href="http://www.rrpowered.com/2012/02/jquery-growing-menu/" class="image-post"><img src="http://www.rrpowered.com/images/growingmenu.png" alt="" class="post-img" /></a><br />
<span id="more-498"></span><br />
&nbsp;<br />
<a href="http://www.rrpowered.com/demo/growingmenu/" alt="img" class="demo">Demo</a><br />
<b>Let&#8217;s start with the jQuery.</b><br />
When the menu gets moused over we will animate and show the hidden text. On mouseout will will hide the text once again.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.ready<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
    $<span class="js-bracket">(</span><span class="js-string">&quot;.nav_bar li&quot;</span><span class="js-bracket">)</span>.mouseover<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
        $<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">stop</span><span class="js-bracket">(</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
            width <span class="js-operator">:</span> <span class="js-string">'350px'</span>
        <span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;

    $<span class="js-bracket">(</span><span class="js-string">&quot;.nav_bar li&quot;</span><span class="js-bracket">)</span>.mouseout<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
        $<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">stop</span><span class="js-bracket">(</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
            width <span class="js-operator">:</span> <span class="js-string">'130px'</span>
        <span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p><b>The HTML structure.</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
</pre>
<pre><span class="html"><span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;nav_bar&quot;</span>&gt;</span>
	<span class="html-other-element">&lt;ul&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 1<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 1<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 2<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 2<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 3<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 3<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 4<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 4<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 5<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 5<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
		<span class="html-other-element">&lt;li&gt;</span>
			<span class="html-other-element">&lt;span&gt;</span>Menu Tab 6<span class="html-other-element">&lt;/span&gt;</span>
			<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 6<span class="html-other-element">&lt;/span&gt;</span>
		<span class="html-other-element">&lt;/li&gt;</span>
	<span class="html-other-element">&lt;/ul&gt;</span>
<span class="html-other-element">&lt;/div&gt;</span></span></pre>
</div>
<p><b>Now put it all together!</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered.com --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.1//EN&quot;</span>
<span class="html-attribute">&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html&gt;</span>
    <span class="html-other-element">&lt;head&gt;</span>
	    <span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/
		ajax/libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
		<span class="html-other-element">&lt;link rel=<span class="html-attribute">&quot;stylesheet&quot;</span> type=<span class="html-attribute">&quot;text/css&quot;</span> href=<span class="html-attribute">&quot;style.css&quot;</span> /&gt;</span>
		<span class="html-other-element">&lt;title&gt;</span>Growing Menu<span class="html-other-element">&lt;/title&gt;</span>
		<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
			$<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.ready<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
				$<span class="js-bracket">(</span><span class="js-string">&quot;.nav_bar li&quot;</span><span class="js-bracket">)</span>.mouseover<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
					$<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">stop</span><span class="js-bracket">(</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
						width <span class="js-operator">:</span> <span class="js-string">'350px'</span>
					<span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
				<span class="js-bracket">}</span><span class="js-bracket">)</span>;

				$<span class="js-bracket">(</span><span class="js-string">&quot;.nav_bar li&quot;</span><span class="js-bracket">)</span>.mouseout<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
					$<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">stop</span><span class="js-bracket">(</span><span class="js-bracket">)</span>.animate<span class="js-bracket">(</span><span class="js-bracket">{</span>
						width <span class="js-operator">:</span> <span class="js-string">'130px'</span>
					<span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
				<span class="js-bracket">}</span><span class="js-bracket">)</span>;
			<span class="js-bracket">}</span><span class="js-bracket">)</span>;
		</span></span>&lt;/script&gt;</span>
	<span class="html-other-element">&lt;/head&gt;</span>
	<span class="html-other-element">&lt;body&gt;</span>
		<span class="html-other-element">&lt;h3&gt;</span>Growing Menu with jQuery<span class="html-other-element">&lt;/h3&gt;</span>
		<span class="html-other-element">&lt;div class=<span class="html-attribute">&quot;nav_bar&quot;</span>&gt;</span>
			<span class="html-other-element">&lt;ul&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 1<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 1<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 2<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 2<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 3<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 3<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 4<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 4<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 5<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 5<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
				<span class="html-other-element">&lt;li&gt;</span>
					<span class="html-other-element">&lt;span&gt;</span>Menu Tab 6<span class="html-other-element">&lt;/span&gt;</span>
					<span class="html-other-element">&lt;span class=<span class="html-attribute">&quot;whole&quot;</span>&gt;</span>The Whole Menu Tab 6<span class="html-other-element">&lt;/span&gt;</span>
				<span class="html-other-element">&lt;/li&gt;</span>
			<span class="html-other-element">&lt;/ul&gt;</span>
		<span class="html-other-element">&lt;/div&gt;</span>
	<span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p><b>Now for the styling</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
</pre>
<pre><span class="css"><span class="css-comment">/*Created by Barrett at RRPowered.com*/</span>
body {
	<span class="css-property">margin<span class="css-selector">:</span><span class="css-value"> 0</span></span>;
	<span class="css-property">padding<span class="css-selector">:</span><span class="css-value"> 0</span></span>;
	<span class="css-property">font-family<span class="css-selector">:</span><span class="css-value"> <span class="css-string">&quot;arial&quot;</span></span></span>;
	<span class="css-property">font-size<span class="css-selector">:</span><span class="css-value"> 12px</span></span>;
}
span {
	<span class="css-property">float<span class="css-selector">:</span><span class="css-value"> left</span></span>;
	<span class="css-property">padding<span class="css-selector">:</span><span class="css-value"> 6px 8px 6px 8px</span></span>;
}
.nav_bar {
	<span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 230px</span></span>;
	<span class="css-property">margin<span class="css-selector">:</span><span class="css-value"> 0 auto</span></span>;
}
.nav_bar ul {
	<span class="css-property">padding<span class="css-selector">:</span><span class="css-value"> 0</span></span>;
	<span class="css-property">margin<span class="css-selector">:</span><span class="css-value"> 0</span></span>;
	<span class="css-property">list-style<span class="css-selector">:</span><span class="css-value"> none</span></span>;
}
.nav_bar li {
	<span class="css-property">background-color<span class="css-selector">:</span><span class="css-value"> #f5f5f5</span></span>;
	<span class="css-property">cursor<span class="css-selector">:</span><span class="css-value"> pointer</span></span>;
	<span class="css-property">font-weight<span class="css-selector">:</span><span class="css-value"> bold</span></span>;
	<span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 130px</span></span>;
	<span class="css-property">overflow<span class="css-selector">:</span><span class="css-value"> hidden</span></span>;
	<span class="css-property">max-height<span class="css-selector">:</span><span class="css-value"> 26px</span></span>;
}
.whole {
	<span class="css-property">background-color<span class="css-selector">:</span><span class="css-value"> #f5f5f5</span></span>;
	<span class="css-property">margin-left<span class="css-selector">:</span><span class="css-value"> 50px</span></span>;
	<span class="css-property">font-weight<span class="css-selector">:</span><span class="css-value"> normal</span></span>;
	<span class="css-property">width<span class="css-selector">:</span><span class="css-value"> 150px</span></span>;
}</span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/k0zoLLVTr9r6H5DQpkIjXNSz9MQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/k0zoLLVTr9r6H5DQpkIjXNSz9MQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/k0zoLLVTr9r6H5DQpkIjXNSz9MQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/k0zoLLVTr9r6H5DQpkIjXNSz9MQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/fSPYO7vaHAk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/02/jquery-growing-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/02/jquery-growing-menu/</feedburner:origLink></item>
		<item>
		<title>Use PHP to show a part of your text</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/XfflIb4CQNc/</link>
		<comments>http://www.rrpowered.com/2012/01/use-php-to-show-a-part-of-your-text/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 06:37:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[substr]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=491</guid>
		<description><![CDATA[Use PHP to show only a part of your text by adding “…” to the end of your message after 10 characters. We&#8217;re gonna start with our text in a variable. 1 2 3 4 5 6 7 $message=&#34;Lorem ipsum &#8230; <a href="http://www.rrpowered.com/2012/01/use-php-to-show-a-part-of-your-text/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Use PHP to show only a part of your text by adding “…” to the end of your message after 10 characters.</h5>
<p><a href="http://www.rrpowered.com/2012/01/use-php-to-show-a-part-of-your-text/" class="image-post"><img src="http://www.rrpowered.com/images/short.png" alt="" class="post-img" /></a><br />
<span id="more-491"></span><br />
We&#8217;re gonna start with our text in a variable.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre>
<pre><span class="php"><span class="php-var">$message</span><span class="php-operator">=</span><span class="php-string">&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam in erat
nec lacus condimentum hendrerit. Vestibulum fringilla ornare augue ut sagittis.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
egestas. Vivamus urna nibh, tristique a suscipit sit amet, tempus vitae lectus.&quot;</span>;</span></pre>
</div>
<p><b>Okay here we go!!!</b><br />
We use the PHP function <b>strlen()</b> to get the length of the text in our variable. Then use the PHP function <b>substr()</b> to only shoe the first 10 characters from the text in our variable. </p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
<pre><span class="php"><span class="php-var">$VarLength</span> <span class="php-operator">=</span> <span class="php-function">strlen</span><span class="php-brackets">(</span><span class="php-var">$message</span><span class="php-brackets">)</span>;
<span class="php-comment">//The length set to 10
</span>
<span class="php-keyword">if</span> <span class="php-brackets">(</span><span class="php-var">$VarLength</span> <span class="php-operator">&gt;</span> <span class="php-number">1</span><span class="php-number">0</span><span class="php-brackets">)</span> <span class="php-brackets">{</span>
<span class="php-comment">/*Add &quot;...&quot; after 10 charecters*/</span>
<span class="php-var">$message</span> <span class="php-operator">=</span> <span class="php-function">substr</span><span class="php-brackets">(</span><span class="php-var">$message</span>,<span class="php-number">0</span>,<span class="php-number">1</span><span class="php-number">0</span><span class="php-brackets">)</span> <span class="php-operator">.</span> <span class="php-string">&quot;...&quot;</span>;
<span class="php-brackets">}</span>
<span class="php-keyword">echo</span> <span class="php-var">$message</span>;</span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/I9Sh003pwYdhbAayLR-Pn0VDHdc/0/da"><img src="http://feedads.g.doubleclick.net/~a/I9Sh003pwYdhbAayLR-Pn0VDHdc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/I9Sh003pwYdhbAayLR-Pn0VDHdc/1/da"><img src="http://feedads.g.doubleclick.net/~a/I9Sh003pwYdhbAayLR-Pn0VDHdc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/XfflIb4CQNc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/01/use-php-to-show-a-part-of-your-text/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/01/use-php-to-show-a-part-of-your-text/</feedburner:origLink></item>
		<item>
		<title>jQuery plugin get variable from plugin</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/7c7Z43kVXg8/</link>
		<comments>http://www.rrpowered.com/2012/01/jquery-plugin-get-variable-from-plugin/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 02:55:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Plugin variable]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=325</guid>
		<description><![CDATA[Today I will show you how to get a variable from your plugin. Lets say you want to know what a variable is that was passing to your plugin. What we have here is the the plugin called myplugin with &#8230; <a href="http://www.rrpowered.com/2012/01/jquery-plugin-get-variable-from-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Today I will show you how to get a variable from your plugin. Lets say you want to know what a variable is that was passing to your plugin.</h5>
<p><a href="http://www.rrpowered.com/2012/01/jquery-plugin-get-variable-from-plugin/" class="image-post"><img src="http://www.rrpowered.com/images/pg.png" alt="" class="post-img" /></a><br />
<span id="more-325"></span><br />
What we have here is the the plugin called <b>myplugin</b> with a <b>function(callback)</b> </p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-string">&quot;#test-div&quot;</span><span class="js-bracket">)</span>.myplugin<span class="js-bracket">(</span>
<span class="js-function-keyword">function</span><span class="js-bracket">(</span>callback<span class="js-bracket">)</span><span class="js-bracket">{</span>
<span class="js-reserved-keyword">if</span><span class="js-bracket">(</span>callback <span class="js-operator">=</span><span class="js-operator">=</span> <span class="js-number">1</span><span class="js-bracket">)</span><span class="js-bracket">{</span>
<span class="js-client-keyword">alert</span><span class="js-bracket">(</span><span class="js-string">&quot;test variable equals 1&quot;</span><span class="js-bracket">)</span>;
<span class="js-bracket">}</span>
<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p><b>The plugin</b><br />
Ok, here is the plugin.<br />
Now to send a variable back to our plugin call. We set a variable called <b>testvariable</b>. Then we create a function called <b>callback</b> with the variable <b>testvariable</b>.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="js"><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span>$<span class="js-bracket">)</span><span class="js-bracket">{</span>
$.fn.myplugin <span class="js-operator">=</span> <span class="js-function-keyword">function</span><span class="js-bracket">(</span>callback<span class="js-bracket">)</span><span class="js-bracket">{</span>
<span class="js-reserved-keyword">var</span> testvariable<span class="js-operator">=</span><span class="js-number">1</span>;
callback<span class="js-bracket">(</span>testvariable<span class="js-bracket">)</span>;
<span class="js-bracket">}</span>
<span class="js-bracket">}</span><span class="js-bracket">)</span><span class="js-bracket">(</span>jQuery<span class="js-bracket">)</span>;</span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/JBIFeyD6sNBl1SCthMQ1cHeEq2U/0/da"><img src="http://feedads.g.doubleclick.net/~a/JBIFeyD6sNBl1SCthMQ1cHeEq2U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JBIFeyD6sNBl1SCthMQ1cHeEq2U/1/da"><img src="http://feedads.g.doubleclick.net/~a/JBIFeyD6sNBl1SCthMQ1cHeEq2U/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/7c7Z43kVXg8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/01/jquery-plugin-get-variable-from-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/01/jquery-plugin-get-variable-from-plugin/</feedburner:origLink></item>
		<item>
		<title>PHP Time Ago</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/r09q29zBOxE/</link>
		<comments>http://www.rrpowered.com/2012/01/php-time-ago/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 21:34:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Ago]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Time Ago]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=469</guid>
		<description><![CDATA[A simple way to display ago with UNIX time. Displaying the time ago. To display the time ago. Just add this where you want to display the time ago. 1 2 3 4 5 6 7 8 9 10 11 &#8230; <a href="http://www.rrpowered.com/2012/01/php-time-ago/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>A simple way to display ago with UNIX time.</h5>
<p><a href="http://www.rrpowered.com/2012/01/php-time-ago/" class="image-post"><img src="http://www.rrpowered.com/images/phpago.png" alt="" class="post-img" /></a><br />
<span id="more-469"></span><br />
<b>Displaying the time ago.</b><br />
To display the time ago. Just add this where you want to display the time ago.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?</span>PHP
<span class="php-comment">/*Created by Barrett at RRPowered.com*/</span>
<span class="php-keyword">include_once</span><span class="php-brackets">(</span><span class="php-string">'ago.php'</span><span class="php-brackets">)</span>;<span class="php-comment">//Include the ago.php file
</span>
<span class="php-var">$cur_time1</span> <span class="php-operator">=</span><span class="php-string">&quot;1291684422&quot;</span>;<span class="php-comment">//Your Unix time from database
</span>
<span class="php-keyword">echo</span> time_ago<span class="php-brackets">(</span><span class="php-var">$cur_time1</span><span class="php-brackets">)</span> ;
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p>&nbsp;<br />
<br />
<b>Here is the PHP file!</b><br />
This file is called <b>ago.php</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?</span>PHP
<span class="php-comment">/*Created by Barrett at RRPowered.com*/</span>
<span class="php-comment">//Call the function
</span>
<span class="php-function">function</span> time_ago<span class="php-brackets">(</span><span class="php-var">$cur_time</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
<span class="php-var">$time_</span> <span class="php-operator">=</span> <span class="php-function">time</span><span class="php-brackets">(</span><span class="php-brackets">)</span> <span class="php-operator">-</span> <span class="php-var">$cur_time</span>;

<span class="php-var">$seconds</span> <span class="php-operator">=</span><span class="php-var">$time_</span>;
<span class="php-var">$minutes</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">6</span><span class="php-number">0</span><span class="php-brackets">)</span>;
<span class="php-var">$hours</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">3</span><span class="php-number">6</span><span class="php-number">0</span><span class="php-number">0</span><span class="php-brackets">)</span>;
<span class="php-var">$days</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">8</span><span class="php-number">6</span><span class="php-number">4</span><span class="php-number">0</span><span class="php-number">0</span><span class="php-brackets">)</span>;
<span class="php-var">$weeks</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">6</span><span class="php-number">0</span><span class="php-number">4</span><span class="php-number">8</span><span class="php-number">0</span><span class="php-number">0</span><span class="php-brackets">)</span>;
<span class="php-var">$months</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">2</span><span class="php-number">4</span><span class="php-number">1</span><span class="php-number">9</span><span class="php-number">2</span><span class="php-number">0</span><span class="php-number">0</span><span class="php-brackets">)</span>;
<span class="php-var">$years</span> <span class="php-operator">=</span> <span class="php-function">round</span><span class="php-brackets">(</span><span class="php-var">$time_</span> <span class="php-operator">/</span> <span class="php-number">2</span><span class="php-number">9</span><span class="php-number">0</span><span class="php-number">3</span><span class="php-number">0</span><span class="php-number">4</span><span class="php-number">0</span><span class="php-number">0</span><span class="php-brackets">)</span>;

<span class="php-comment">//Seconds
</span>
<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$seconds</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">6</span><span class="php-number">0</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

   <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$seconds seconds ago&quot;</span>;   

<span class="php-comment">//Minutes
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span> <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$minutes</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">6</span><span class="php-number">0</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

   <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$minutes</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
   <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one minute ago&quot;</span>;
   <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
   <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$minutes minutes ago&quot;</span>;
   <span class="php-brackets">}</span>

<span class="php-comment">//Hours
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span> <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$hours</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">2</span><span class="php-number">4</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

  <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$hours</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one hour ago&quot;</span>;
  <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$hours hours ago&quot;</span>;
  <span class="php-brackets">}</span>

<span class="php-comment">//Days
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span> <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$days</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">7</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

   <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$days</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
   <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one day ago&quot;</span>;
   <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
   <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$days days ago&quot;</span>;
   <span class="php-brackets">}</span>

<span class="php-comment">//Weeks
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span> <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$weeks</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">4</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

  <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$weeks</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one week ago&quot;</span>;
  <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$weeks weeks ago&quot;</span>;
  <span class="php-brackets">}</span>

<span class="php-comment">//Months
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span> <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$months</span> <span class="php-operator">&lt;</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-number">2</span><span class="php-brackets">)</span><span class="php-brackets">{</span>

  <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$months</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one month ago&quot;</span>;
  <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$months months ago&quot;</span>;
  <span class="php-brackets">}</span>

<span class="php-comment">//Years
</span>
<span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>  

  <span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-var">$year</span> <span class="php-operator">=</span><span class="php-operator">=</span> <span class="php-number">1</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;one year ago&quot;</span>;
  <span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
  <span class="php-var">$time</span><span class="php-operator">=</span><span class="php-string">&quot;$year years ago&quot;</span>;
  <span class="php-brackets">}</span>  

<span class="php-brackets">}</span>
<span class="php-keyword">return</span> <span class="php-var">$time</span>;
<span class="php-brackets">}</span>
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/QD53Bakb1FC4PnmR6ZLpU1pqnDo/0/da"><img src="http://feedads.g.doubleclick.net/~a/QD53Bakb1FC4PnmR6ZLpU1pqnDo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QD53Bakb1FC4PnmR6ZLpU1pqnDo/1/da"><img src="http://feedads.g.doubleclick.net/~a/QD53Bakb1FC4PnmR6ZLpU1pqnDo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/r09q29zBOxE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/01/php-time-ago/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/01/php-time-ago/</feedburner:origLink></item>
		<item>
		<title>Check If A Users Picture Exists Using PHP</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/y658ZpaScEE/</link>
		<comments>http://www.rrpowered.com/2012/01/check-if-a-users-picture-exists-using-php/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 05:03:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Check]]></category>
		<category><![CDATA[Check If users Picture Exists]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Users image]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=464</guid>
		<description><![CDATA[Today We will use PHP to check if a users picture exists. Let&#8217;s get started! First We set the users and default picture location into a variable. Next We check if the users picture exists. If the users picture exists &#8230; <a href="http://www.rrpowered.com/2012/01/check-if-a-users-picture-exists-using-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Today We will use PHP to check if a users picture exists.</h5>
<p><a href="http://www.rrpowered.com/2012/01/check-if-a-users-picture-exists-using-php/" class="image-post"><img src="http://www.rrpowered.com/images/checkpic.png" alt="" class="post-img" /></a><br />
<span id="more-464"></span><br />
<b>Let&#8217;s get started!</b><br />
First We set the users and default picture location into a variable. Next We check if the users picture exists. If the users picture exists We will display it. If not We show the default picture.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre>
<pre><span class="php"><span class="php-comment">/*The location to the default picture*/</span>
<span class="php-var">$no_picture</span><span class="php-operator">=</span><span class="php-string">&quot;default.jpg&quot;</span>;

<span class="php-comment">/*The location to the users picture*/</span>
<span class="php-var">$picture</span><span class="php-operator">=</span><span class="php-string">&quot;$user/picture.jpg&quot;</span>;

<span class="php-comment">/*We will use the PHP file_exists function*/</span>
<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">file_exists</span><span class="php-brackets">(</span><span class="php-var">$picture</span><span class="php-brackets">)</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
<span class="php-comment">/*If users picture exists show it*/</span>
<span class="php-var">$pic</span><span class="php-operator">=</span><span class="php-string">'&lt;img src=&quot;'</span><span class="php-operator">.</span><span class="php-var">$picture</span><span class="php-operator">.</span><span class="php-string">'&quot; alt=&quot;&quot; /&gt;'</span>;
<span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
<span class="php-comment">/*If users picture dose not exists shoe default picture instead*/</span>
<span class="php-var">$pic</span><span class="php-operator">=</span><span class="php-string">'&lt;img src=&quot;'</span><span class="php-operator">.</span><span class="php-var">$no_picture</span><span class="php-operator">.</span><span class="php-string">'&quot; alt=&quot;&quot; /&gt;'</span>;
<span class="php-brackets">}</span>

<span class="php-comment">/*Usage*/</span>
<span class="php-keyword">echo</span> <span class="php-var">$pic</span></span></pre>
</div>
<p>&nbsp;<br />
<br />
<b>Used in a function</b><br />
We can also put it in a Function. Like this!</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre>
<pre><span class="php"><span class="php-function">function</span> UserPic<span class="php-brackets">(</span><span class="php-var">$user</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
<span class="php-comment">/*The location to the default picture*/</span>

<span class="php-var">$no_picture</span><span class="php-operator">=</span><span class="php-string">&quot;default.jpg&quot;</span>;
<span class="php-comment">/*The location to the users picture*/</span>
<span class="php-var">$picture</span><span class="php-operator">=</span><span class="php-string">&quot;$user/picture.jpg&quot;</span>;

<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">file_exists</span><span class="php-brackets">(</span><span class="php-var">$picture</span><span class="php-brackets">)</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
<span class="php-var">$pic</span><span class="php-operator">=</span><span class="php-string">'&lt;img src=&quot;'</span><span class="php-operator">.</span><span class="php-var">$picture</span><span class="php-operator">.</span><span class="php-string">'&quot; alt=&quot;&quot; /&gt;'</span>;
<span class="php-brackets">}</span><span class="php-keyword">else</span><span class="php-brackets">{</span>
<span class="php-var">$pic</span><span class="php-operator">=</span><span class="php-string">'&lt;img src=&quot;'</span><span class="php-operator">.</span><span class="php-var">$no_picture</span><span class="php-operator">.</span><span class="php-string">'&quot; alt=&quot;&quot; /&gt;'</span>;
<span class="php-brackets">}</span>
<span class="php-keyword">return</span> <span class="php-var">$pic</span>;
<span class="php-brackets">}</span>

<span class="php-comment">/*Usage*/</span>
UserPic<span class="php-brackets">(</span><span class="php-var">$user</span><span class="php-brackets">)</span></span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/4-tVJlu9unFu0M8N3Sk65nBI4Os/0/da"><img src="http://feedads.g.doubleclick.net/~a/4-tVJlu9unFu0M8N3Sk65nBI4Os/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/4-tVJlu9unFu0M8N3Sk65nBI4Os/1/da"><img src="http://feedads.g.doubleclick.net/~a/4-tVJlu9unFu0M8N3Sk65nBI4Os/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/y658ZpaScEE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2012/01/check-if-a-users-picture-exists-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2012/01/check-if-a-users-picture-exists-using-php/</feedburner:origLink></item>
		<item>
		<title>Public API with PHP, jQuery and JSON</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/74HIRJXmm2c/</link>
		<comments>http://www.rrpowered.com/2011/12/public-api-with-php-jquery-and-json/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 05:51:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Public API]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=452</guid>
		<description><![CDATA[Okay I&#8217;m gonna show you a simple way of creating a Public API using PHP, jQuery and JSON. Demo Let&#8217;s get started! First we need to include the connection to the database. This file will be called connection.php 1 2 &#8230; <a href="http://www.rrpowered.com/2011/12/public-api-with-php-jquery-and-json/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Okay I&#8217;m gonna show you a simple way of creating a Public API using PHP, jQuery and JSON.</h5>
<p><a href="http://www.rrpowered.com/2011/12/public-api-with-php-jquery-and-json/" class="image-post"><img src="http://www.rrpowered.com/images/publicapi.png" alt="" class="post-img" /></a><br />
<span id="more-452"></span><br />
<a href="http://www.rrpowered.com/code/RRPowered-PublicAPI.zip" alt="img" class="download">Demo</a><br />
<b>Let&#8217;s get started!</b><br />
First we need to include the connection to the database. This file will be called connection.php</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?</span>PHP
<span class="php-comment">/*Created by Barrett at RRPowered.com*/</span>
<span class="php-comment">/*PHP Public API*/</span>

<span class="php-comment">//Our connection to the database
</span>
<span class="php-function">mysql_connect</span><span class="php-brackets">(</span><span class="php-string">&quot;HOST_NAME&quot;</span>,<span class="php-string">&quot;USER_NAME&quot;</span>,<span class="php-string">&quot;PASSWORD&quot;</span><span class="php-brackets">)</span> OR DIE <span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;
<span class="php-function">mysql_select_db</span><span class="php-brackets">(</span><span class="php-string">&quot;DATABASE&quot;</span><span class="php-brackets">)</span> OR DIE <span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p>
Now for the API. First we include the database connection file. Then we check if the function exists.<br />
Now that we checked if the function exists we call the passed function. What&#8217;s next? Creating the function it&#8217;s self. So we create a function called <b>allUsers()</b>. Select all users from the database,<br />
put them into an array then loop through them putting them into a single array. Now for the JSON, we use the PHP <b>json_encode()</b> function.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?</span>PHP
<span class="php-comment">/*Created by Barrett at RRPowered.com*/</span>
<span class="php-comment">/*PHP Public API*/</span>

<span class="php-comment">//Include the database connection
</span>
<span class="php-keyword">include</span><span class="php-brackets">(</span><span class="php-string">'connection.php'</span><span class="php-brackets">)</span>;

<span class="php-comment">//Now we check if the function exists
</span>
<span class="php-keyword">if</span><span class="php-brackets">(</span><span class="php-function">function_exists</span><span class="php-brackets">(</span><span class="php-var">$_GET</span><span class="php-brackets">[</span><span class="php-string">'method'</span><span class="php-brackets">]</span><span class="php-brackets">)</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
	<span class="php-comment">//Call the passed function
</span>
	<span class="php-var">$_GET</span><span class="php-brackets">[</span><span class="php-string">'method'</span><span class="php-brackets">]</span><span class="php-brackets">(</span><span class="php-brackets">)</span>;
<span class="php-brackets">}</span>

<span class="php-comment">//Here is the function to get
</span>
<span class="php-function">function</span> allUsers<span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
	<span class="php-comment">//Get all users from the database
</span>
	<span class="php-var">$sql_users</span><span class="php-operator">=</span><span class="php-function">mysql_query</span><span class="php-brackets">(</span><span class="php-string">&quot;SELECT * FROM users&quot;</span><span class="php-brackets">)</span> OR DIE <span class="php-brackets">(</span><span class="php-function">mysql_error</span><span class="php-brackets">(</span><span class="php-brackets">)</span><span class="php-brackets">)</span>;
	<span class="php-comment">//New array called users
</span>
	<span class="php-var">$users</span><span class="php-operator">=</span><span class="php-keyword">array</span><span class="php-brackets">(</span><span class="php-brackets">)</span>;
	<span class="php-comment">//Loop through each result and put each result into a single array
</span>
	<span class="php-keyword">while</span><span class="php-brackets">(</span><span class="php-var">$user</span><span class="php-operator">=</span><span class="php-function">mysql_fetch_array</span><span class="php-brackets">(</span><span class="php-var">$sql_users</span><span class="php-brackets">)</span><span class="php-brackets">)</span><span class="php-brackets">{</span>
	<span class="php-var">$users</span><span class="php-brackets">[</span><span class="php-brackets">]</span><span class="php-operator">=</span><span class="php-var">$user</span>;
	<span class="php-brackets">}</span>
	<span class="php-comment">//Set $users to json encode $users
</span>
	<span class="php-var">$users</span><span class="php-operator">=</span><span class="php-function">json_encode</span><span class="php-brackets">(</span><span class="php-var">$users</span><span class="php-brackets">)</span>;
	<span class="php-comment">//Okay here is the JSONP
</span>
	<span class="php-keyword">echo</span> <span class="php-var">$_GET</span><span class="php-brackets">[</span><span class="php-string">'jsoncallback'</span><span class="php-brackets">]</span><span class="php-operator">.</span><span class="php-string">'('</span><span class="php-operator">.</span><span class="php-var">$users</span><span class="php-operator">.</span><span class="php-string">')'</span>;
<span class="php-brackets">}</span>
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p>&nbsp;<br />
<b>Now for the jQuery</b><br />
The url in the <b>$.getJSON()</b> function looks like<br />
<b>http://www.YOUR_WEBITE_ADDRESS.com/api.php?method=allUsers&#038;jsoncallback=?</b><br />
the method is set to <b>method=allUsers</b> and the jsoncallback set to <b>&#038;jsoncallback=?</b>.<br />
Now we loop through the result an display them in a DIV.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
<span class="js-comment">/* we use the jQuery get json function to get data
from are API. The first parameter is the url of our
API file called api.php */</span>
    $.getJSON<span class="js-bracket">(</span><span class="js-string">&quot;http://www.YOUR_WEBITE_ADDRESS.com/api.php?method=allUsers&amp;jsoncallback=?&quot;</span>,
        <span class="js-function-keyword">function</span><span class="js-bracket">(</span>dataGet<span class="js-bracket">)</span> <span class="js-bracket">{</span>
	    <span class="js-reserved-keyword">for</span><span class="js-bracket">(</span>allUsers <span class="js-reserved-keyword">in</span> dataGet<span class="js-bracket">)</span> <span class="js-bracket">{</span>
	        <span class="js-reserved-keyword">var</span> user <span class="js-operator">=</span> dataGet<span class="js-bracket">[</span>allUsers<span class="js-bracket">]</span>;
		$<span class="js-bracket">(</span><span class="js-string">&quot;#output&quot;</span><span class="js-bracket">)</span>.append<span class="js-bracket">(</span>user.name <span class="js-operator">+</span> <span class="js-string">&quot;&lt;br /&gt;&quot;</span><span class="js-bracket">)</span>;
        <span class="js-bracket">}</span>
    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
<b>Now for the final html</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</pre>
<pre><span class="html"><span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span>
<span class="html-attribute">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html lang=<span class="html-attribute">&quot;en&quot;</span>&gt;</span>
    <span class="html-other-element">&lt;head&gt;</span>
	<span class="html-other-element">&lt;title&gt;</span>PHP Public API<span class="html-other-element">&lt;/title&gt;</span>
	<span class="html-comment">&lt;!-- Include the latest version of jQuery library --&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/
	ajax/libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
		$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
		<span class="js-comment">/* we use the jQuery get json function to get data
		from are API. The first parameter is the url of our
		API file called api.php */</span>
		    $.getJSON<span class="js-bracket">(</span><span class="js-string">&quot;http://www.YOUR_WEBITE_ADDRESS.com/api.php?method=allUsers&amp;jsoncallback=?&quot;</span>,
		    <span class="js-function-keyword">function</span><span class="js-bracket">(</span>dataGet<span class="js-bracket">)</span> <span class="js-bracket">{</span>
	                <span class="js-reserved-keyword">for</span><span class="js-bracket">(</span>allUsers <span class="js-reserved-keyword">in</span> dataGet<span class="js-bracket">)</span> <span class="js-bracket">{</span>
			    <span class="js-reserved-keyword">var</span> user <span class="js-operator">=</span> dataGet<span class="js-bracket">[</span>allUsers<span class="js-bracket">]</span>;
			    $<span class="js-bracket">(</span><span class="js-string">&quot;#output&quot;</span><span class="js-bracket">)</span>.append<span class="js-bracket">(</span>user.name <span class="js-operator">+</span> <span class="js-string">&quot;&lt;br /&gt;&quot;</span><span class="js-bracket">)</span>;
			<span class="js-bracket">}</span>
		    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
		<span class="js-bracket">}</span><span class="js-bracket">)</span>;
        </span></span>&lt;/script&gt;</span>
    <span class="html-other-element">&lt;/head&gt;</span>
    <span class="html-other-element">&lt;body&gt;</span>
	<span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;output&quot;</span>&gt;</span><span class="html-other-element">&lt;/div&gt;</span>
   <span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/k2f8eWrIj8l6EBdDeQmGPJUWl_k/0/da"><img src="http://feedads.g.doubleclick.net/~a/k2f8eWrIj8l6EBdDeQmGPJUWl_k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/k2f8eWrIj8l6EBdDeQmGPJUWl_k/1/da"><img src="http://feedads.g.doubleclick.net/~a/k2f8eWrIj8l6EBdDeQmGPJUWl_k/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/74HIRJXmm2c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2011/12/public-api-with-php-jquery-and-json/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.rrpowered.com/2011/12/public-api-with-php-jquery-and-json/</feedburner:origLink></item>
		<item>
		<title>Animated header background with jQuery</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/yt8Hud2EMdA/</link>
		<comments>http://www.rrpowered.com/2011/12/animated-header-background-with-jquery/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 21:01:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Animated]]></category>
		<category><![CDATA[Animated Header]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=413</guid>
		<description><![CDATA[Today I’m gonna show you how to make an awesome animate header, using jQuery and CSS. View it in action in the video below. Watch in full screen for best results. &#160; Demo Demo lets get started. The first things &#8230; <a href="http://www.rrpowered.com/2011/12/animated-header-background-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>Today I’m gonna show you how to make an awesome animate header, using jQuery and CSS.</h5>
<p><a href="http://www.rrpowered.com/2011/12/animated-header-background-with-jquery/" class="image-post"><img src="http://www.rrpowered.com/images/headeranimated.png" alt="" class="post-img" /></a><br />
<span id="more-413"></span><br />
<![if !IE]></p>
<div class="video-outline">
<b>View it in action in the video below.</b></p>
<div class="video-js-box vim-css" id="videoz">
    <video class="video-js" width="600" height="260" controls preload poster="http://www.rrpowered.com/images/rrvideo.png"><br />
      <source src="http://rrpowered.com/demo/animatedheader/animatedheader.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /><br />
      <source src="http://rrpowered.com/demo/animatedheader/animatedheader.mp4" type='video/webm; codecs="vp8, vorbis"' /><br />
      <source src="http://rrpowered.com/demo/animatedheader/animatedheader.mp4" type='video/ogg; codecs="theora, vorbis"' /><br />
    </video>
  </div>
<p>
<div class="video-green">Watch in full screen for best results.</div>
</div>
<p><![endif]><br />
&nbsp;<br />
<a href="http://www.rrpowered.com/demo/animatedheader/" alt="img" class="demo">Demo</a><br />
<a href="http://www.rrpowered.com/code/RRPowered-animatedheader.zip" alt="img" class="download">Demo</a><br />
<b>lets get started.</b><br />
The first things we have are the options for are background, the <b>scrollSpeed</b> for how fast the background image moves, the <b>step</b> is for the pixel movement per step, the <b>current</b> set to 0, the <b>imageHeight</b> this is the height of our background image, the <b>HeaderHeight</b> for how high we want our header to be.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
</pre>
<pre><span class="js"><span class="js-reserved-keyword">var</span> scrollSpeed <span class="js-operator">=</span> <span class="js-number">1</span><span class="js-number">5</span>;       <span class="js-comment">// Speed in milliseconds
</span>
            <span class="js-reserved-keyword">var</span> step <span class="js-operator">=</span> <span class="js-number">1</span>;               <span class="js-comment">// How many pixels to move per step
</span>
            <span class="js-reserved-keyword">var</span> current <span class="js-operator">=</span> <span class="js-number">0</span>;            <span class="js-comment">// The current pixel row
</span>
            <span class="js-reserved-keyword">var</span> imageHeight <span class="js-operator">=</span> <span class="js-number">4</span><span class="js-number">3</span><span class="js-number">0</span><span class="js-number">0</span>;     <span class="js-comment">// Height of the background image
</span>
            <span class="js-reserved-keyword">var</span> headerHeight <span class="js-operator">=</span> <span class="js-number">3</span><span class="js-number">0</span><span class="js-number">0</span>;     <span class="js-comment">// Header hight
</span>

            <span class="js-comment">//The pixel row where to start a new loop
</span>
            <span class="js-reserved-keyword">var</span> restartPosition <span class="js-operator">=</span> <span class="js-operator">-</span><span class="js-bracket">(</span>imageHeight <span class="js-operator">-</span> headerHeight<span class="js-bracket">)</span>;

            <span class="js-function-keyword">function</span> scrollBg<span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>

                <span class="js-comment">//Go to next pixel row.
</span>
                current <span class="js-operator">-</span><span class="js-operator">=</span> step;

                <span class="js-comment">//If at the end of the image, then go to the top.
</span>
                <span class="js-reserved-keyword">if</span> <span class="js-bracket">(</span>current <span class="js-operator">=</span><span class="js-operator">=</span> restartPosition<span class="js-bracket">)</span><span class="js-bracket">{</span>
                    current <span class="js-operator">=</span> <span class="js-number">0</span>;
                <span class="js-bracket">}</span>
                <span class="js-comment">//Set the CSS position of the header.
</span>
                $<span class="js-bracket">(</span><span class="js-string">&quot;#header&quot;</span><span class="js-bracket">)</span>.css<span class="js-bracket">(</span><span class="js-string">&quot;background-position&quot;</span>,<span class="js-string">&quot;0 &quot;</span><span class="js-operator">+</span>current<span class="js-operator">+</span><span class="js-string">&quot;px&quot;</span><span class="js-bracket">)</span>;

            <span class="js-bracket">}</span>

            <span class="js-comment">//Calls the scrolling function repeatedly
</span>
            <span class="js-reserved-keyword">var</span> init <span class="js-operator">=</span> <span class="js-native-keyword">setInterval</span><span class="js-bracket">(</span><span class="js-string">&quot;scrollBg()&quot;</span>, scrollSpeed<span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
<b>Now the CSS.</b><br />
 We just set the height and background image that we want.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
</pre>
<pre><span class="js">#header<span class="js-bracket">{</span>
            height<span class="js-operator">:</span> <span class="js-number">3</span><span class="js-number">0</span><span class="js-number">0</span>px;
            background<span class="js-operator">:</span> url<span class="js-bracket">(</span><span class="js-string">'bg.jpg'</span><span class="js-bracket">)</span> repeat<span class="js-operator">-</span>y <span class="js-client-keyword">scroll</span> left top;
            <span class="js-bracket">}</span></span></pre>
</div>
<p><b>Ok the HTML setup.</b><br />
Just one div is all we need.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre><span class="html"><span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;header&quot;</span>&gt;</span>
            <span class="html-other-element">&lt;h1&gt;</span>Animated Header<span class="html-other-element">&lt;/h1&gt;</span>
        <span class="html-other-element">&lt;/div&gt;</span></span></pre>
</div>
<p><b>Now put it all together.</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html&gt;</span>
<span class="html-other-element">&lt;html lang=<span class="html-attribute">&quot;en&quot;</span>&gt;</span>
    <span class="html-other-element">&lt;head&gt;</span>
        <span class="html-other-element">&lt;meta charset=<span class="html-attribute">&quot;UTF-8&quot;</span> /&gt;</span>
        <span class="html-other-element">&lt;title&gt;</span>Animated header background with jQuery<span class="html-other-element">&lt;/title&gt;</span>
        <span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/ajax/
libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
        <span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
            <span class="js-reserved-keyword">var</span> scrollSpeed <span class="js-operator">=</span> <span class="js-number">1</span><span class="js-number">5</span>;       <span class="js-comment">// Speed in milliseconds
</span>
            <span class="js-reserved-keyword">var</span> step <span class="js-operator">=</span> <span class="js-number">1</span>;               <span class="js-comment">// How many pixels to move per step
</span>
            <span class="js-reserved-keyword">var</span> current <span class="js-operator">=</span> <span class="js-number">0</span>;            <span class="js-comment">// The current pixel row
</span>
            <span class="js-reserved-keyword">var</span> imageHeight <span class="js-operator">=</span> <span class="js-number">4</span><span class="js-number">3</span><span class="js-number">0</span><span class="js-number">0</span>;     <span class="js-comment">// Height of the background image
</span>
            <span class="js-reserved-keyword">var</span> headerHeight <span class="js-operator">=</span> <span class="js-number">3</span><span class="js-number">0</span><span class="js-number">0</span>;     <span class="js-comment">// Header hight
</span>

            <span class="js-comment">//The pixel row where to start a new loop
</span>
            <span class="js-reserved-keyword">var</span> restartPosition <span class="js-operator">=</span> <span class="js-operator">-</span><span class="js-bracket">(</span>imageHeight <span class="js-operator">-</span> headerHeight<span class="js-bracket">)</span>;

            <span class="js-function-keyword">function</span> scrollBg<span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>

                <span class="js-comment">//Go to next pixel row.
</span>
                current <span class="js-operator">-</span><span class="js-operator">=</span> step;

                <span class="js-comment">//If at the end of the image, then go to the top.
</span>
                <span class="js-reserved-keyword">if</span> <span class="js-bracket">(</span>current <span class="js-operator">=</span><span class="js-operator">=</span> restartPosition<span class="js-bracket">)</span><span class="js-bracket">{</span>
                    current <span class="js-operator">=</span> <span class="js-number">0</span>;
                <span class="js-bracket">}</span>
                <span class="js-comment">//Set the CSS position of the header.
</span>
                $<span class="js-bracket">(</span><span class="js-string">&quot;#header&quot;</span><span class="js-bracket">)</span>.css<span class="js-bracket">(</span><span class="js-string">&quot;background-position&quot;</span>,<span class="js-string">&quot;0 &quot;</span><span class="js-operator">+</span>current<span class="js-operator">+</span><span class="js-string">&quot;px&quot;</span><span class="js-bracket">)</span>;

            <span class="js-bracket">}</span>

            <span class="js-comment">//Calls the scrolling function repeatedly
</span>
            <span class="js-reserved-keyword">var</span> init <span class="js-operator">=</span> <span class="js-native-keyword">setInterval</span><span class="js-bracket">(</span><span class="js-string">&quot;scrollBg()&quot;</span>, scrollSpeed<span class="js-bracket">)</span>;
        </span></span>&lt;/script&gt;</span>
        <span class="html-style-element">&lt;style type=<span class="css-string">&quot;text/css&quot;</span>&gt;<span class="css"><span class="css">
            #header{
            <span class="css-property">height<span class="css-selector">:</span><span class="css-value"> 300px</span></span>;
            <span class="css-property">background<span class="css-selector">:</span><span class="css-value"> url(<span class="css-string">'bg.jpg'</span>) repeat-y scroll left top</span></span>;
            }
        </span></span>&lt;/style&gt;</span>
    <span class="html-other-element">&lt;/head&gt;</span>
    <span class="html-other-element">&lt;body&gt;</span>
        <span class="html-other-element">&lt;div id=<span class="html-attribute">&quot;header&quot;</span>&gt;</span>
            <span class="html-other-element">&lt;h1&gt;</span>Animated Header<span class="html-other-element">&lt;/h1&gt;</span>
        <span class="html-other-element">&lt;/div&gt;</span>
    <span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p>So now you can use this awesome animated header in your project.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/v1LKqOxuxrZPJMMJRuEUqGY_574/0/da"><img src="http://feedads.g.doubleclick.net/~a/v1LKqOxuxrZPJMMJRuEUqGY_574/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/v1LKqOxuxrZPJMMJRuEUqGY_574/1/da"><img src="http://feedads.g.doubleclick.net/~a/v1LKqOxuxrZPJMMJRuEUqGY_574/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/yt8Hud2EMdA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2011/12/animated-header-background-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://rrpowered.com/demo/animatedheader/animatedheader.mp4" length="1901546" type="video/mp4" />
		<feedburner:origLink>http://www.rrpowered.com/2011/12/animated-header-background-with-jquery/</feedburner:origLink></item>
		<item>
		<title>jQuery change title text like Facebook</title>
		<link>http://feedproxy.google.com/~r/rrpowereds/~3/8x_oCcKD0bM/</link>
		<comments>http://www.rrpowered.com/2011/12/jquery-change-title-text-like-facebook/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 08:10:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[Change title text]]></category>
		<category><![CDATA[FaceBook]]></category>
		<category><![CDATA[Facebook like]]></category>
		<category><![CDATA[Facebook title]]></category>
		<category><![CDATA[Title]]></category>

		<guid isPermaLink="false">http://www.rrpowered.com/?p=421</guid>
		<description><![CDATA[So you want to know how to change to title text with jQuery? Well your in luck, because today I&#8217;m gonna show you how. This is how Facebook does it. View it in action in the video below. Watch in &#8230; <a href="http://www.rrpowered.com/2011/12/jquery-change-title-text-like-facebook/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h5>So you want to know how to change to title text with jQuery? Well your in luck, because today I&#8217;m gonna show you how.<br />
This is how Facebook does it.</h5>
<p><a href="http://www.rrpowered.com/2011/12/jquery-change-title-text-like-facebook" class="image-post"><img src="http://www.rrpowered.com/images/changetitle.gif" alt="" class="post-img" /></a><br />
<span id="more-421"></span><br />
<![if !IE]></p>
<div class="video-outline">
<b>View it in action in the video below.</b></p>
<div class="video-js-box vim-css" id="videoz">
    <video class="video-js" width="600" height="260" controls preload poster="http://www.rrpowered.com/images/rrvideo.png"><br />
      <source src="http://rrpowered.com/demo/changetitle/changetitle.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' /><br />
      <source src="http://rrpowered.com/demo/changetitle/changetitle.mp4" type='video/webm; codecs="vp8, vorbis"' /><br />
      <source src="http://rrpowered.com/demo/changetitle/changetitle.mp4" type='video/ogg; codecs="theora, vorbis"' /><br />
    </video>
  </div>
<p>
<div class="video-green">Watch in full screen for best results.</div>
</div>
<p><![endif]><br />
&nbsp;<br />
<a href="http://www.rrpowered.com/demo/changetitle/" alt="img" class="demo">Demo</a><br />
<a href="http://www.rrpowered.com/code/RRPowered-RRPowered-Changetitletext.zip" alt="img" class="download">Demo</a><br />
<b>Okay, lets get started.</b></p>
<p>When the submit button is clicked we get the value from #changeTitle.<br />
Then put it into a variable called changeTitle.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="js"><span class="js-reserved-keyword">var</span> changeTitle <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#changeTitle&quot;</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
Okay here is where the magic happens. We use the .attr API to change the title text.<br />
There are two values for this, the first one is the attribute name and the second is<br />
the value, which in our case is the chanegTitle variable.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;title&quot;</span>, changeTitle<span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
<b>Now lets put it together.</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered.com --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span>
<span class="html-attribute">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html lang=<span class="html-attribute">&quot;en&quot;</span>&gt;</span>
    <span class="html-other-element">&lt;head&gt;</span>
        <span class="html-other-element">&lt;title&gt;</span>jQuery change title text like Facebook<span class="html-other-element">&lt;/title&gt;</span>
	<span class="html-comment">&lt;!-- Include the latest version of the jQuery library. --&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/
	ajax/libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
            $<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
		$<span class="js-bracket">(</span><span class="js-string">&quot;#submit&quot;</span><span class="js-bracket">)</span>.<span class="js-client-keyword">click</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>

		<span class="js-comment">/*When the submit button is clicked we get the value
		from #changeTitle. Then put it into a variable called changeTitle.*/</span>
		<span class="js-reserved-keyword">var</span> changeTitle <span class="js-operator">=</span> $<span class="js-bracket">(</span><span class="js-string">&quot;#changeTitle&quot;</span><span class="js-bracket">)</span>.val<span class="js-bracket">(</span><span class="js-bracket">)</span>;

		<span class="js-comment">/*Okay, here is where the magic happens. We use the .attr API to
		change the title text. There are two values for this, the first
		one is the attribute name and the second is the value, which in
		our case is the chanegTitle variable.*/</span>
		$<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;title&quot;</span>, changeTitle<span class="js-bracket">)</span>;

		<span class="js-bracket">}</span><span class="js-bracket">)</span>;
	    <span class="js-bracket">}</span><span class="js-bracket">)</span>;
        </span></span>&lt;/script&gt;</span>
    <span class="html-other-element">&lt;/head&gt;</span>
    <span class="html-other-element">&lt;body&gt;</span>
	<span class="html-comment">&lt;!-- Just a simple html form with two inputs --&gt;</span>
        <span class="html-form-element">&lt;form&gt;</span>
	    <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;text&quot;</span> id=<span class="html-attribute">&quot;changeTitle&quot;</span> /&gt;</span>
	    <span class="html-form-element">&lt;input type=<span class="html-attribute">&quot;button&quot;</span> value=<span class="html-attribute">&quot;Change title text&quot;</span> id=<span class="html-attribute">&quot;submit&quot;</span> /&gt;</span>
	<span class="html-form-element">&lt;/form&gt;</span>
    <span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p>&nbsp;<br />
<b>Now lets update the title text from an external page every 5 seconds.</b><br />
Okay lets get started!<br />
We will be using the javascript setTimeout() method to check for updates very 5 seconds.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre><span class="js"><span class="js-native-keyword">setTimeout</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>
    <span class="js-comment">//Code here
</span>
<span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
Now we will load the txt.php file with the jQuery .load API.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">load</span><span class="js-bracket">(</span><span class="js-string">&quot;txt.php&quot;</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span>changeTitle<span class="js-bracket">)</span><span class="js-bracket">{</span>
    <span class="js-comment">//Code here
</span>
<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
<b>Here is the final jQuery.</b><br />
This will check the txt.php file every 5 seconds and then update the title text to the text<br />
that text that we get from our txt.php file.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
</pre>
<pre><span class="js">$<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
    <span class="js-native-keyword">setTimeout</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span>
        $<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">load</span><span class="js-bracket">(</span><span class="js-string">&quot;txt.php&quot;</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span>changeTitle<span class="js-bracket">)</span><span class="js-bracket">{</span>
            $<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;title&quot;</span>, changeTitle<span class="js-bracket">)</span>;
        <span class="js-bracket">}</span><span class="js-bracket">)</span>;
    <span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;
<span class="js-bracket">}</span><span class="js-bracket">)</span>;</span></pre>
</div>
<p>&nbsp;<br />
<b>Now for the final code put all together.</b></p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre>
<pre><span class="html"><span class="html-comment">&lt;!-- Created by Barrett at RRPowered.com --&gt;</span>
<span class="html-other-element">&lt;!DOCTYPE html PUBLIC <span class="html-attribute">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> <span class="html-attribute">&quot;http://www.w3.org/TR/xhtml1/
DTD/xhtml1-strict.dtd&quot;</span>&gt;</span>
<span class="html-other-element">&lt;html lang=<span class="html-attribute">&quot;en&quot;</span>&gt;</span>
    <span class="html-other-element">&lt;head&gt;</span>
	<span class="html-other-element">&lt;title&gt;</span>Test<span class="html-other-element">&lt;/title&gt;</span>
        <span class="html-comment">&lt;!-- Include the latest version of the jQuery library. --&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span> src=<span class="html-attribute">&quot;http://ajax.googleapis.com/
	ajax/libs/jquery/1.7.1/jquery.min.js&quot;</span>&gt;<span class="js"><span class="js"></span></span>&lt;/script&gt;</span>
	<span class="html-script-element">&lt;script type=<span class="html-attribute">&quot;text/javascript&quot;</span>&gt;<span class="js"><span class="js">
	    $<span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span> <span class="js-bracket">{</span>
                <span class="js-comment">//Now we will check the txt.php file every 5 seconds.
</span>
		<span class="js-native-keyword">setTimeout</span><span class="js-bracket">(</span><span class="js-function-keyword">function</span><span class="js-bracket">(</span><span class="js-bracket">)</span><span class="js-bracket">{</span> 

		    <span class="js-comment">/*Now we will load the txt.php file with the jQuery .load API.*/</span>
		    $<span class="js-bracket">(</span><span class="js-reserved-keyword">this</span><span class="js-bracket">)</span>.<span class="js-client-keyword">load</span><span class="js-bracket">(</span><span class="js-string">&quot;txt.php&quot;</span>, <span class="js-function-keyword">function</span><span class="js-bracket">(</span>changeTitle<span class="js-bracket">)</span><span class="js-bracket">{</span>
		        <span class="js-comment">/*Okay here is where the magic happens. We use the .attr API to
                        change the title text. There are two values for this, the first
                        one is the attribute name and the second is the value, which in
                        our case is the chanegTitle variable.*/</span>
		        $<span class="js-bracket">(</span><span class="js-client-keyword">document</span><span class="js-bracket">)</span>.attr<span class="js-bracket">(</span><span class="js-string">&quot;title&quot;</span>, changeTitle<span class="js-bracket">)</span>;
		    <span class="js-bracket">}</span><span class="js-bracket">)</span>;

		<span class="js-bracket">}</span>, <span class="js-number">5</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-number">0</span><span class="js-bracket">)</span>;<span class="js-comment">//Value is in milliseconds 5000 = 5 seconds
</span>
            <span class="js-bracket">}</span><span class="js-bracket">)</span>;
        </span></span>&lt;/script&gt;</span>
    <span class="html-other-element">&lt;/head&gt;</span>
    <span class="html-other-element">&lt;body&gt;</span>
        <span class="html-comment">&lt;!-- Your content would go here! --&gt;</span>
    <span class="html-other-element">&lt;/body&gt;</span>
<span class="html-other-element">&lt;/html&gt;</span></span></pre>
</div>
<p>&nbsp;<br />
<b>The PHP</b><br />
Okay now for the PHP file called txt.php.</p>
<div class="fvch-code">
<pre class="fvch-line-numbers">1
2
3
4
5
6
7
8
9
10
11
</pre>
<pre><span class="php"><span class="php-script-tag">&lt;?</span>PHP
<span class="php-comment">/*Created by Barrett at RRPowered.com*/</span>
<span class="php-comment">//This is where your new title text would go.
</span>
<span class="php-var">$text</span> <span class="php-operator">=</span> <span class="php-string">&quot;My text here!&quot;</span>;
<span class="php-keyword">echo</span> <span class="php-var">$text</span>;
<span class="php-script-tag">?&gt;<span class="html"></span></span></span></pre>
</div>
<p><b>I hope you enjoyed this tutorial.</b></p>

<p><a href="http://feedads.g.doubleclick.net/~a/X0HIa0kAFlR56q6J-mv42dQ0h_k/0/da"><img src="http://feedads.g.doubleclick.net/~a/X0HIa0kAFlR56q6J-mv42dQ0h_k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/X0HIa0kAFlR56q6J-mv42dQ0h_k/1/da"><img src="http://feedads.g.doubleclick.net/~a/X0HIa0kAFlR56q6J-mv42dQ0h_k/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/rrpowereds/~4/8x_oCcKD0bM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rrpowered.com/2011/12/jquery-change-title-text-like-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://rrpowered.com/demo/changetitle/changetitle.mp4" length="474120" type="video/mp4" />
		<feedburner:origLink>http://www.rrpowered.com/2011/12/jquery-change-title-text-like-facebook/</feedburner:origLink></item>
	</channel>
</rss>

