<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Roshan Bhattarai's Blog -  A blog about PHP, Ajax, JavaScript, CSS and Web 2.0 &#187; css</title>
	<atom:link href="http://roshanbh.com.np/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Thu, 10 Jun 2010 11:38:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sleek and Smooth animated menu using jQuery</title>
		<link>http://roshanbh.com.np/2009/07/sleek-smooth-animated-menu-jquery.html</link>
		<comments>http://roshanbh.com.np/2009/07/sleek-smooth-animated-menu-jquery.html#comments</comments>
		<pubDate>Tue, 28 Jul 2009 09:54:55 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[animation]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=332</guid>
		<description><![CDATA[Today, I&#8217;m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long time and I came across a website, whose menu impressed me a lot. But checking it in a while, I found it it was built using mootools.  Since it was [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2009%2F07%2Fsleek-smooth-animated-menu-jquery.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2009%2F07%2Fsleek-smooth-animated-menu-jquery.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Today, I&#8217;m going to show you something interesting with jQuery. Yesterday I was thinking something to post something programming related stuff  in blog after long time and I came across a website, whose menu impressed me a lot. But checking it in a while, I found it it was built using mootools.  Since it was in mootools, I thought of replicating it in jQuery. I have two example of similar menu, first using jQuery core and CSS and another uses <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">jQuery easing plugin</a> to give bounce effect to the same menu.And I&#8217;ve added one more example which I though would be nice menu to show you guys.<span id="more-332"></span></p>
<p><strong><a title="sleek and smooth jquery menu" href="http://roshanbh.com.np/examples/sleek-smooth-hover-menu/" target="_blank">VIEW DEMO</a></strong></p>
<p>First of let me start, with the images which i&#8217;ve used in the background to create the first two menus.</p>
<p><img class="alignnone" style="border:none;" title="smooth jquery menu" src="http://roshanbh.com.np/examples/sleek-smooth-hover-menu/bg.png" alt="smooth jquery menu" width="192" height="25" /> and <img class="alignnone" style="border:none;" title="sleek jquery menu" src="http://roshanbh.com.np/examples/sleek-smooth-hover-menu/bg-right.png" alt="sleek jquery menu" width="8" height="25" /></p>
<p style="text-align: justify;">Please note that the please keep the left image as big as possible if you&#8217;re menu text can be long.</p>
<p style="text-align: justify;">Now, let&#8217;s look at the html code</p>
<h4>Html code for the animated jquery menu</h4>
<pre class="prettyprint" style="overflow:auto">&lt;ul class="nav" id="nav1"&gt;
   &lt;li class="first"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#"&gt;About us&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
   &lt;li class="last"&gt;&lt;a href="#"&gt;Tutorials&lt;/a&gt;&lt;/li&gt;
   &lt;li class="bg"&gt;&lt;div class="left"&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p style="text-align: justify;">All the list elements are fairly simple and the list with class &#8220;<strong>bg</strong>&#8221; is the one which holds the background image for the menu. The code is same for the first and second example but for the third example we use list with class <strong>ybg </strong>instead of bg.</p>
<pre style="border: 1px solid #888888; padding: 2px;"> &lt;li class="ybg"&gt;&lt;/li&gt;</pre>
<h4>CSS code for the smooth jQuery menu</h4>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">ul.nav {</span> <span style="color: #000080;">list-style:none;  overflow:hidden;</span>  <span style="color: #ff00ff;">}

ul.nav li {</span> <span style="color: #000080;">float:left; height:39px; background-color:#000;  padding:0 5px;</span> <span style="color: #ff00ff;"> }

ul.nav li.first {</span>
  <span style="color: #000080;">-moz-border-radius-topleft:9px; -webkit-border-top-left-radius:9px;
  -moz-border-radius-bottomleft:9px;  -webkit-border-bottom-left-radius:9px;</span>
<span style="color: #ff00ff;">}

ul.nav li.last {</span>
<span style="color: #000080;">-moz-border-radius-topright:9px; -webkit-border-top-right-radius:9px;
-moz-border-radius-bottomright:9px; -webkit-border-bottom-right-radius:9px;</span>
<span style="color: #ff00ff;">}

ul.nav li.bg {</span>
  <span style="color: #000080;"> margin:7px 0px 0px 3px; padding-right:8px; position:absolute;
   z-index:50; left:155px; width:60px; background:url(bg-right.png) no-repeat right top;</span>
<span style="color: #ff00ff;">}

ul.nav li .left {</span><span style="color: #000080;"> background:url(bg.png) no-repeat left top; height:39px; </span> <span style="color: #ff00ff;">}

ul.nav li a {</span>
  <span style="color: #000080;">padding:8px 20px;  color:#FFF; font-size:18px; font-weight:bold; display:block;
  text-decoration:none; z-index:100; position:relative;</span>
<span style="color: #ff00ff;">}

ul.nav li.ybg {</span>
  <span style="color: #000080;">background-color:#FB0; position:absolute; z-index:50;
  left:165px; width:55px; height:4px; margin-top:6px;</span>
<span style="color: #ff00ff;">}</span></pre>
<p style="text-align: justify;">As you can see there, I&#8217;ve used CSS3 rounded corners for the first and last elements of list(obviously doesn&#8217;t work IE). Furthermore, the list with class <strong>bg</strong> is used for the first and second menu examples where the image is used in the background and which moves around on mouse hover on menu with sleek effect. Please note that this list must be positioned <span style="color: #800000;">absolutely</span>.</p>
<p style="text-align: justify;">The <strong>ybg</strong> class is used for the background effect for the third menu in the example, which first moves to the menu which has current mouse position and then starts sliding down.<br />
After this, let&#8217;s get into jQuery code for providing the sleek effect for the hover menu.</p>
<h4>jQuery code for animation in the  on menu</h4>
<pre class="prettyprint" style="overflow:auto">$('#nav1 li a').hover(function()
{
  var offset=$(this).offset();
  var thiswidth =$(this).width()+13;
  $('#nav1 li.bg').stop().animate({left:offset.left+"px",width:thiswidth+"px"},600);
},
function()
{
  $('#nav1 li.bg').stop().animate({left:"155px",width:"60px"},600);
});</pre>
</p>
<p style="text-align: justify;">The above is the code for the first menu. You can see that on the hover effect of anchor, first we&#8217;ve calculated the offset of menu and also width of the anchor element. Then, finally used animate function of jQuery to move the menu and increse the width of the background to create the nice and sleek effect.</p>
<p style="text-align: justify;">As you can see the second function of hover menu, which is called when mouse is released from the anchor, just reset back the menu to it&#8217;s original position.</p>
<p style="text-align: justify;">The code is exactly same for the second menu except the following line,</p>
<pre class="prettyprint" style="overflow:auto">$('#nav3 li.bg').stop().animate({left:"155px",width:"60px"},600,'easeOutBounce');</pre>
<p style="text-align: justify;">You can see the difference easily where I&#8217;ve used <strong>easeOutBounce</strong> easing effect for the bounce out effect when mouse is released form the menu.</p>
<pre class="prettyprint">$('#nav2 li a').hover(function()
{
  var offset=$(this).offset();
  var thiswidth =$(this).width()+13;
  $('#nav2 li.ybg').stop().animate({left:offset.left+9+"px",width:thiswidth+"px"},400,function(){
     $(this).animate({height:"28px"},150);
  });
},
function()
{
   $('#nav2 li.ybg').stop().animate({height:"4px"},150,function(){
      $(this).animate({left:"165px",width:"55px"},600,'easeOutBounce');
   });
});</pre>
<p style="text-align: justify;">And you can see in the above code of the third menu, first of all the menu gets slided to the current position of menu and then the height of the background gets increased to 28px, giving a nice effect. And when mouse is released from the menu, the same things happens but in the reverse order.</p>
<p style="text-align: justify;"><strong><a title="sleek and smooth jquery menu" href="http://roshanbh.com.np/codes/sleek-smooth-hover-menu.zip">DOWNLOAD SOURCE CODE</a></strong></p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=332&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2009/07/sleek-smooth-animated-menu-jquery.html/feed</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Get the book &#8220;The Art &amp; Science of CSS&#8221; at free of cost</title>
		<link>http://roshanbh.com.np/2008/11/free-css-book-sitepoint.html</link>
		<comments>http://roshanbh.com.np/2008/11/free-css-book-sitepoint.html#comments</comments>
		<pubDate>Fri, 21 Nov 2008 19:50:04 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=312</guid>
		<description><![CDATA[Are you a web developer ? Are you a web designer? The you must not leave this offer. I don&#8217;t know weather you know about this offer or not. Sitepoint is giving the book The Art &#38; Science of CSS at free of cost. I think you&#8217;re might interested in getting this book, just follow [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F11%2Ffree-css-book-sitepoint.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F11%2Ffree-css-book-sitepoint.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Are you a web developer ? Are you a web designer? The you must not leave this offer. I don&#8217;t know weather you know about this offer or not. Sitepoint is giving the book <a href="http://www.sitepoint.com/books/cssdesign1/" target="_blank">The Art &amp; Science of CSS</a> at free of cost. I think you&#8217;re might interested in getting this book, just follow the simple instruction and that great book will be yours.<br />
<span id="more-312"></span><br />
Here is the steps you&#8217;ve to do to get that book at free of cost&#8230;</p>
<p>1) Follow <a rel="nofollow" href="http://twitter.com/sitepointdotcom" target="_blank">sitepointdotcom</a> at twitter and they will send you the direct message to you at twitter.</p>
<p>OR</p>
<p>2) If  you don&#8217;t have twitter account the, go here  <a rel="nofollow" href="http://twitaway.com/" target="_blank">http://twitaway..com/</a> and enter your email address. They will send you the download link of that book in your email address.</p>
<p>If you have twitter account then follow me on twitter <strong><a href="http://twitter.com/roshanbh">@roshanbh</a></strong>. We can stay in touch to share our experiences.Believe me twitter is great place for sharing messages.</p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=312&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/11/free-css-book-sitepoint.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>W3c markup validation and Big websites &#8211; Is it really needed?</title>
		<link>http://roshanbh.com.np/2008/09/w3c-markup-validation-big-websites-really-needed.html</link>
		<comments>http://roshanbh.com.np/2008/09/w3c-markup-validation-big-websites-really-needed.html#comments</comments>
		<pubDate>Wed, 10 Sep 2008 10:27:20 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=260</guid>
		<description><![CDATA[Today, I would like to talk about W3C XHTML validation service.This service checks the XHTML of your website and reports you if your web page have any error or warning according to standard of W3C. If you are talking about this website currently you&#8217;ll find 74 Errors, 24 warning(s) and frankly I&#8217;ve never been bothered [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F09%2Fw3c-markup-validation-big-websites-really-needed.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F09%2Fw3c-markup-validation-big-websites-really-needed.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Today, I would like to talk about <a href="http://validator.w3.org" target="_blank">W3C XHTML validation</a> service.This service checks the XHTML of your website and reports you if your web page have any error or warning according to standard of W3C. If you are talking about this website currently you&#8217;ll find 74 Errors, 24 warning(s)       and frankly I&#8217;ve never been bothered about correcting those errors of XHTML because it takes a bit of time and believe me I&#8217;m a very lazy boy. In this post, I would like to show you a interesting data of W3C validation among the top rated websites.You&#8217;ll be amazed to come to know that they&#8217;re also lazy like me <img src='http://roshanbh.com.np/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p><span id="more-260"></span></p>
<h4>W3C XHTML validation of Big website.</h4>
<p style="text-align: justify;">I&#8217;ve checked the W3C&#8217;s XHTML validation among the top 7 wesites rated by <a href="http://www.alexa.com/site/ds/top_sites?ts_mode=global&amp;lang=none" target="_blank">ALEXA</a>. You can look at the result below.</p>
<pre><a href="http://validator.w3.org/check?uri=http://www.google.com"><img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-google.gif" border="0" alt="" width="500" height="57" /></a></pre>
<pre><a href="http://validator.w3.org/check?uri=http://www.youtube.com"><img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-youtube.gif" border="0" alt="" width="500" height="57" /></a></pre>
<pre><a href="http://validator.w3.org/check?uri=http://www.yahoo.com"><img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-yahoo.gif" border="0" alt="" width="500" height="57" /></a></pre>
<pre><a href="http://validator.w3.org/check?uri=http://www.msn.com">
<img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-msn.gif" border="0" alt="" width="500" height="57" /></a><a href="http://validator.w3.org/check?uri=http://www.live.com">
<img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-live.gif" border="0" alt="" width="500" height="57" /></a><a href="http://validator.w3.org/check?uri=http://www.faceboo.com">
<img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-facebook.gif" border="0" alt="" width="500" height="57" /></a></pre>
<pre><a href="http://validator.w3.org/check?uri=http://www.myspace.com">
<img class="alignnone size-full wp-image-267" title="w3c-myspace" src="http://roshanbh.com.np/wp-content/uploads/2008/09/w3c-myspace.gif" border="0" alt="" width="500" height="57" />
</a></pre>
<p style="text-align: justify;">As you can see in the above stat, Microsoft&#8217;s websites only cared about W3C validation. Other websites are not really worried about this validation.  I&#8217;m even wondered above stat from Gooogle which don&#8217;t have much elements in their home page but a search box and some hyperlinks.</p>
<h4>Is XHTML validation really needed in your web page?</h4>
<p style="text-align: justify;">I&#8217;m not the person who can decide weather the XHTML validation is really needed or not in you web page. But you know web designers spent a lot time for XHTML validations of each page. Do you think it really worth ? Why the big guns website doesn&#8217;t follow the W3C standard? Is your website is XHTML valid ? Please share your thought.</p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=260&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/09/w3c-markup-validation-big-websites-really-needed.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Making dashed or dotted link using CSS</title>
		<link>http://roshanbh.com.np/2008/08/dashed-dotted-link-css.html</link>
		<comments>http://roshanbh.com.np/2008/08/dashed-dotted-link-css.html#comments</comments>
		<pubDate>Fri, 15 Aug 2008 10:12:28 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=220</guid>
		<description><![CDATA[Today, one of the friend of my office asked me how to make dotted or dashsed link as he was looking for &#8220;text-decoration&#8221; for making it.Today, I&#8217;ve come up with a very simple technique to make a dotted or dashed hyperlink using CSS.This technique might be known to most of you guys but it might [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F08%2Fdashed-dotted-link-css.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F08%2Fdashed-dotted-link-css.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Today, one of the friend of my office asked me how to make dotted or dashsed  link as he was looking for &#8220;text-decoration&#8221; for making it.Today, I&#8217;ve come up with a very simple technique to make a dotted or dashed hyperlink using CSS.This technique might be known to most of you guys but it might be useful for those guys who don&#8217;t know about this technique.</p>
<p><span id="more-220"></span></p>
<h4>Making dotted and dashed link using CSS</h4>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">a
{</span>
<span style="color: #333399;">border-bottom:1px dotted #FF0000;
text-decoration:none;
color:#FF0000;</span>
<span style="color: #ff00ff;">}</span></pre>
<p>As, you can can you can use the border-bottom property to add the border in the bottom and then you must specify that text-decoration property to &#8220;none&#8221; to remove the underline from hyperlink which comes default in hyperlink. In the similar fashion, you can create dashed underline link with the following example code.</p>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">a
{</span>
<span style="color: #333399;">border-bottom:1px dashed #FF0000;
text-decoration:none;
color:#FF0000;</span>
<span style="color: #ff00ff;">}</span></pre>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=220&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/08/dashed-dotted-link-css.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Top Floating message box using jQuery</title>
		<link>http://roshanbh.com.np/2008/07/top-floating-message-box-using-jquery.html</link>
		<comments>http://roshanbh.com.np/2008/07/top-floating-message-box-using-jquery.html#comments</comments>
		<pubDate>Sun, 13 Jul 2008 09:29:55 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[message box]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=162</guid>
		<description><![CDATA[Last time, I&#8217;ve shown you how to create a alert box using jQuery. This time, I&#8217;ve come up with another tutorial to show you how to display floating message box in the top of  the browser using jQuery. The message box always get displayed at the top of the browser although you move across the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F07%2Ftop-floating-message-box-using-jquery.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F07%2Ftop-floating-message-box-using-jquery.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">Last time, I&#8217;ve shown you how to create a alert box using jQuery. This time, I&#8217;ve come up with another tutorial to show you how to display floating message box in the top of  the browser using jQuery. The message box always get displayed at the top of the browser although you move across the document with help of scroll bar. Now, let&#8217;s kick out this tutorial for creating floating message box using jQuery.</p>
<p><span id="more-162"></span></p>
<p style="text-align: justify; font-weight: bold;"><a href="http://roshanbh.com.np/examples/floating-message-jquery/" target="_blank">LIVE DEMO</a></p>
<h4>HTML code for floating message box using jQuery</h4>
<pre class="prettyprint" style="overflow:auto">&lt;div id="message_box"&gt;
    &lt;img id="close_message" style="float:right;cursor:pointer" src="12-em-cross.png" /&gt;
    The floating message goes here
&lt;/div&gt;

&lt;div&gt;
  ..............
  other content goes here
  ..................
&lt;/div&gt;
</pre>
<p style="text-align: justify;">The message box which is going to float in the top of the browser is inside the div with id &#8220;message-box&#8221; and this div is defined with the class &#8220;cornerbox&#8221;. And the small image with id &#8220;close_message&#8221; to close the message box and is displayed in the right hand side by setting the <span style="color: #333399;">float</span> attribute of CSS to <span style="color: #333399;">right</span> .</p>
<h4>CSS code for floating message box using jQuery</h4>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">#message_box {</span>
<span style="color: #333399;">position: absolute;
top: 0; left: 0;
z-index: 10;
background:#ffc;
padding:5px;
border:1px solid #CCCCCC;
text-align:center;
font-weight:bold;
width:99%;</span>
<span style="color: #ff00ff;">}</span></pre>
<p style="text-align: justify;">You can see that CSS code for the floating message box is straightforward and you can change the color , size etc. according to your choice. But keep in mind that, &#8220;position&#8221; property must be absolute so that this message box doesn&#8217;t distract the other boxes and &#8220;z-index&#8221; must be set higher so that the it overlaps the other content of the web page.</p>
<h4>jQuery code for floating message box</h4>
<pre class="prettyprint" style="overflow:auto">&lt;script type="text/javascript" language="javascript" src="jquery-1.2.6.min.js"&gt;&lt;/script&gt;</pre>
<p style="text-align: justify;">You must notice that I&#8217;ve used jquery 1.2.6 in this example as dimension plugin of jquery is embedded in the this version of jQuery. If you use the lesser version of jQuery than 1.2.6 then must use the dimension plugin of jQuery to use this example.</p>
<pre class="prettyprint" style="overflow:auto">//scroll the message box to the top offset of browser's scrool bar
$(window).scroll(function()
{
  $('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});
});
</pre>
<p style="text-align: justify;">As you can when the window gets scrolled this function is called and the box gets moved as the &#8220;top&#8221; property of message box is set to different pixel using <a href="http://docs.jquery.com/Plugins/dimensions/scrollTop">scrollTop()</a> function, which had been the part dimension plugin of jQuery. This function return the scroll top offset of the matched element and in our example this return the scroll top offeset of the browser&#8217;s window. Another thing you must notice in the animate function that queue is set to false which makes the animation to skip the queue and begins running immediately otherwise the animation may stuck in the queue and looks ugly.</p>
<pre class="prettyprint" style="overflow:auto">//when the close button at right corner of the message box is clicked
$('#close_message').click(function()
{
  //the messagebox gets scrool down with top property and gets hidden with zero opacity
  $('#message_box').animate({ top:"+=15px",opacity:0 }, "slow");
});</pre>
<p style="text-align: justify;">It is the simple animation when the image with close sign is clicked, the message box slides down below and gets hidden because its opacity set to zero in the animation function.</p>
<p style="text-align: justify; font-weight: bold;"><a href="http://roshanbh.com.np/codes/floating-message-jquery.zip" target="_blank">DOWNLOAD FULL SOURCE CODE </a></p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=162&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/07/top-floating-message-box-using-jquery.html/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>How to control the case of characters using CSS?</title>
		<link>http://roshanbh.com.np/2008/07/control-character-case-css-text-transform.html</link>
		<comments>http://roshanbh.com.np/2008/07/control-character-case-css-text-transform.html#comments</comments>
		<pubDate>Sun, 06 Jul 2008 10:25:00 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[tips and technique]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=148</guid>
		<description><![CDATA[How are you controlling the case of the characters in your project. Talking about me, I was using ucwords() function of PHP to control the case of the characters when required. Today, I come to know  two new property of CSS which controls the output of the case of the characters of the words. You [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F07%2Fcontrol-character-case-css-text-transform.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F07%2Fcontrol-character-case-css-text-transform.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: justify;">How are you controlling the case of the characters in your project. Talking about me, I was using <a href="http://www.php.net/ucwords" target="_blank">ucwords()</a> function of PHP to control the case of the characters when required. Today, I  come to know  two new property of CSS which controls the output of the case of the characters of the words.</p>
<p style="text-align: justify;"><span id="more-148"></span><br />
You can control the characters using &#8220;text-transform&#8221; and &#8220;font-variant&#8221; property of the CSS to do this. You can change the characters of words to upper case, lower case and capitalize the first character of the word.Furthermore, you can use &#8220;font-variant&#8221; to display the font in small caps font i.e. all the lower case characters are converted into uppercase character but have small font size compared to text with character capitalized. Let&#8217;s see example,</p>
<h4>Example of using text-transform and font-variant</h4>
<pre class="prettyprint" style="overflow:auto ">&lt;span style="text-transform: capitalize"&gt;bill gates&lt;/span&gt; =&gt; <span style="text-transform: capitalize">bill gates</span>
&lt;span style="text-transform:lowercase"&gt;Bill Gates&lt;/span&gt; =&gt;  <span style="text-transform:lowercase">Bill Gates</span>
&lt;span style="text-transform: uppercase"&gt;bill gates&lt;/span&gt; =&gt; <span style="text-transform: uppercase">bill gates</span>
&lt;span style="font-variant:small-caps"&gt;Bill Gates&lt;/span&gt; =&gt; <span style="font-variant:small-caps">Bill Gates</span></pre>
<p style="text-align: justify;">As you can see clearly in the example how the character of case is changed using text-transform and font-variant property of CSS. I hope these property might be useful for those people who didn&#8217;t know about these properties. But &#8220;text-transform&#8221; should have had one more attribute to capitalize the first character of sentence, I&#8217;m missing that <img src='http://roshanbh.com.np/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  .</p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=148&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/07/control-character-case-css-text-transform.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Animated content navigation effect using jquery</title>
		<link>http://roshanbh.com.np/2008/05/animated-content-navigation-jquery.html</link>
		<comments>http://roshanbh.com.np/2008/05/animated-content-navigation-jquery.html#comments</comments>
		<pubDate>Thu, 08 May 2008 06:58:20 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/?p=104</guid>
		<description><![CDATA[I always get bored with the same stuffs. And, I see same kind of content navigation to the different websites. Click a link, let&#8217;s the whole web page gets loaded and new page gets displayed. It would be better to show another content in the same page with few animation without loading the whole page. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F05%2Fanimated-content-navigation-jquery.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F05%2Fanimated-content-navigation-jquery.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p align="justify">I always get bored with the same stuffs. And, I see same kind of content navigation to the different websites. Click a link, let&#8217;s the whole web page gets loaded and new page gets displayed. It would be better to show another content in the same page with few animation without loading the whole page.</p>
<p><span id="more-104"></span></p>
<p align="justify">In this post, I&#8217;ll show you how to make various animation to the content using jQuery. First of let&#8217;s start looking at the HTML and CSS code,</p>
<p align="justify"><strong>HTML Code for animated content navigation </strong></p>
<pre class="prettyprint" style="overflow:auto ">&lt;a href="#home" class="linkclass" &gt;Home&lt;/a&gt;
&lt;a href="#about_us" class="linkclass" &gt;About Us&lt;/a&gt;
&lt;a href="#service" class="linkclass" &gt;Services&lt;/a&gt;
&lt;a href="#contact_us" class="linkclass" &gt;Contact Us&lt;/a&gt;

&lt;div class="container"&gt;
    &lt;div id="home" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="about_us" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="service" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="contact_us" class="msg_body"&gt;  content goes here &lt;/div&gt;
&lt;/div&gt;</pre>
<p align="justify">As you can see above, the &#8220;href&#8221; attribute of the anchor tag is pointing to the id of the &#8220;div&#8221;. &#8220;Home&#8221; anchor tag is pointing to &#8220;#home&#8221;. In jquery, id of a element is represented by adding &#8220;#&#8221; prefix to the id of that element.</p>
<p align="justify"><strong>CSS code for animated content navigation</strong></p>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">.container
{</span>
  <span style="color: #333399;"> width:312px;
   margin-top:20px;</span>
<span style="color: #ff00ff;">}
.msg_body
{</span>
 <span style="color: #333399;"> border:1px solid #CCCCCC;
  padding: 5px;
  width: 300px;
  background-color:#F4F4F8;
  text-align:justify;
  position:absolute;</span>
<span style="color: #ff00ff;">}
.linkclass
{</span>
<span style="color: #333399;">  font-weight:bold;
  color:#006699;</span>
<span style="color: #ff00ff;">}</span></pre>
<p align="justify">Above CSS code is pretty straight forward and you can change it according to your need. Note that, there is position attribute to &#8220;absolute&#8221; in the &#8220;msg_body&#8221; class. Now let&#8217;s look at various the javaScript code in jQuery to make the various animated content navigation</p>
<p align="justify"><strong>Faded content navigation</strong></p>
<p align="justify"><strong><a href="http://roshanbh.com.np/examples/content-move/index.html" target="_blank">View Live Demo </a></strong></p>
<pre class="prettyprint" style="overflow:auto"> //hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
  $('.msg_body').fadeOut("slow");
  $($(this).attr("href")).fadeIn("slow");
});</pre>
<p align="justify">In the first line of javaScript code, all the element with class &#8220;msg_body&#8221; is made hidden except the first element with same class. And when the anchor with class &#8220;linkclass&#8221; is clicked, the element with class &#8220;msg_body&#8221; gets faded out which is being displayed in browser. And, the element with the id value in the &#8220;href&#8221; attribute of the clicked anchor tag, get displayed in browser with fading effect.</p>
<p align="justify"><strong>Shutter like content navigation effect<br />
</strong></p>
<p align="justify"><strong><a href="http://roshanbh.com.np/examples/content-move/index1.html" target="_blank">View Live Demo </a></strong></p>
<pre class="prettyprint" style="overflow:auto">//hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
   $('.msg_body').hide("fast");
   $($(this).attr("href")).show("slow");
});</pre>
<p align="justify">The code is same as the above code but here &#8220;hide()&#8221; and &#8220;show()&#8221; function of jQuery is used to hide and display the content in different manner.</p>
<p align="justify"><strong>Sliding Content Navigation Effect </strong></p>
<p align="justify"><strong><a href="http://roshanbh.com.np/examples/content-move/index3.html" target="_blank">View Live Demo </a></strong></p>
<pre class="prettyprint" style="overflow:auto"> //hide the all div except first one
 $('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
   $('.msg_body').slideUp("slow");
   $($(this).attr("href")).slideDown("slow"););
});</pre>
<p align="justify">This is another content navigation effect with sliding manner. &#8220;slideUp()&#8221; and &#8220;slideDown()&#8221; functions of jQuery is used to display this kind of effect.</p>
<p align="justify"><strong><a href="http://roshanbh.com.np/codes/content-move.zip">Download full source code</a></strong></p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=104&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/05/animated-content-navigation-jquery.html/feed</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>How to make rounded corner textbox using css</title>
		<link>http://roshanbh.com.np/2008/04/how-to-make-rounded-corner-textbox.html</link>
		<comments>http://roshanbh.com.np/2008/04/how-to-make-rounded-corner-textbox.html#comments</comments>
		<pubDate>Tue, 01 Apr 2008 17:27:24 +0000</pubDate>
		<dc:creator>Roshan</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[rounded corner]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://roshanbh.com.np/2008/04/how-to-make-rounded-corner-textbox.html</guid>
		<description><![CDATA[In this post, I&#8217;ll explain to you how to make the rounded corner textbox using a image and css. Text box is placed over a container element whose background image is the key of the rounded corner textbox. This is the image which I&#8217;ve used in my example, don&#8217;t click and start typing it just [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float:right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F04%2Fhow-to-make-rounded-corner-textbox.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Froshanbh.com.np%2F2008%2F04%2Fhow-to-make-rounded-corner-textbox.html&amp;source=roshanbh&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p align="justify">In this post, I&#8217;ll explain to  you how to make the rounded corner textbox using a  image and css. Text box is placed over a container element whose background image is the key of the rounded corner textbox.</p>
<p><span id="more-72"></span><br />
This is the image which I&#8217;ve used in my example, don&#8217;t click and start typing it just a image for now.</p>
<pre style="display: block"><img style="display: block" src="http://roshanbh.com.np/images/login_bg.gif" border="0" alt="" /></pre>
<p align="justify">Now let&#8217;s look at the html and css code to display rounded corner textbox.</p>
<h4>HTML Code for rounded corner textbox</h4>
<pre class="prettyprint" style="overflow: auto">&lt;div class="loginboxdiv"&gt;
  &lt;input class="loginbox" name="username" type="text" /&gt;
&lt;/div&gt;</pre>
<p align="justify">The container &#8220;div&#8221; contains the background image of rounded corners and inside of that the real textbox resides.</p>
<h4>CSS Code for rounded corner textbox:</h4>
<pre style="border: 1px solid #888888; padding: 2px"><span style="color: #ff00ff;">.loginboxdiv
{</span>
<span style="color: #333399;"> margin:0;
 height:21px;
 width:146px;
 background:url(login_bg.gif) no-repeat bottom;</span>
<span style="color: #ff00ff;">}</span>

<span style="color: #ff00ff;">.loginbox
{</span>
 <span style="color: #333399;">background:none;
 border:none;
 width:134px;
 height:15px;
 margin:0;
 padding: 2px 7px 0px 7px;
 font-family:Verdana, Arial, Helvetica, sans-serif;
 font-size:11px;</span>
<span style="color: #ff00ff;">}</span></pre>
<p align="justify">The above CSS code is straight forward, the height and width of the class &#8220;loginboxdiv&#8221; should be exactly same as the above image which is of &#8220;146X21&#8243; pixels. The class &#8220;loginbox&#8221; is the class of the textbox. As you can see in the css, border is removed and height , width and padding are managed according to the size of the background image.</p>
<p align="justify"><strong>Working Example- You can type in the rounded corner textbox:</strong></p>
<style>
.loginboxdiv{   margin:0;   height:21px;   width:146px;   background:url(http://roshanbh.com.np/images/login_bg.gif) no-repeat bottom; } .loginbox {   background:none;   border:none;   width:134px;   height:15px;   margin:0;   padding: 2px 7px 0px 7px; font-family:Verdana, Arial, Helvetica, sans-serif;   font-size:10px;  }</style>
<div class="loginboxdiv">
<input class="loginbox" name="username" type="text" /></div>
<p align="justify"><strong><br />
Download Code:</strong></p>
<p><a title="rounded textbox using css" href="http://roshanbh.com.np/codes/rounded-textbox.zip" target="_blank">Click here to download full source code</a></p>
<img src="http://roshanbh.com.np/?ak_action=api_record_view&id=72&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://roshanbh.com.np/2008/04/how-to-make-rounded-corner-textbox.html/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 5/22 queries in 0.224 seconds using disk: basic
Object Caching 1268/1300 objects using disk: basic

Served from: roshanbh.com.np @ 2012-05-21 20:11:25 -->
