Logo

WebMuch

Everything about the web

  • Home
  • Tutorials
  • Articles
  • Resources
  • About
  • Contact

Subscribe To: RSS Feed RSS | Email

Website Build-Up Series – Sidebar

Website Build-Up Series - Sidebar PictureThis is second part of the website build-up series. In this part we’ll continue where we left of, we’ll make the sidebar with a jQuery accordion and a news box with curved corners and we’ll make the main content container ready to work with for the next part.

By: Aayush

Date: April 13, 2009

Tags: CSS, HTML, jQuery

Author: Aayush Shastri

Hello! I'm a freelance web and graphic designer who loves working on anything related to web. I'm currently the website administrator of WebMuch. You can find me on Twitter! and Facebook.

Preview:

Website Build-Up Series - Sidebar Preview
So as per the preview picture above we will be creating the sidebar of the website and make the main content container ready to work with, for the next part of this tutorial series.

Preparing:

  • First we will go to the jQueryUI website and click on build custom download.
  • Now we deselect all the options and then reselect only the ones we need.

Website Build-Up Series - Sidebar Picture

What we need:

  • We need the UI Core.
  • We need only one widget: Accordion.
  • We need only Effects Core.
  • Make sure to make the download 1.5.3 (Legacy release, for jQuery 1.2.6).

Now, open the zip file downloaded and go into the js folder and copy the file “jquery-ui-1.5.3.custom.min.js” into a new folder in your website directory, call the folder js. We will not be needing the jQuery JavaScript because we will be using google’s CDN to jQuery as it saves us bandwidth and it is cached on a lot of computers already, therefore, makes the site faster.

Now, for our curved corners go to: blue-anvil and download the Anti-Aliased rounded corners with jQuery zip file. Open the zip file and copy “jquery.curvycorners.packed.js” into the js folder of our website directory.

We then include all the JavaScript files in our web page right before ending the body tag:

<!-- From here -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script><!-- This is google's free link to the jQuery library -->
<script src="./js/jquery-ui-1.5.3.custom.min.js" type="text/javascript"></script>
<script src="./js/jquery.curvycorners.packed.js" type="text/javascript"></script>
<script type="text/javascript">
    //jQuery code here...
</script>
<!-- Till here -->
</body>

So from here we finally start coding. Open our index.html in a text editor and start right where we left off i.e. after closing the header division and we will finish our code right before the end of the main container tag which we made in the last tutorial.

</div><!-- end header -->
<!-- Start here -->
<div id="content-container">

	<div id="sidebar">

		<h3>Products:</h3>
		<div id="accordion-container">
			<ul id="accordion">
				<li>
					<a href="#recent" class="heading">Recent Entries</a>
					<ul id="recent">
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
					</ul>
				</li>
				<li>
					<a href="#popular" class="heading">Popular Entries</a>
					<ul id="popular">
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
						<li><a href="#">Recent Entry Title</a></li>
					</ul>
				</li>
				<li>
					<a href="#categories" class="heading">Categories</a>
					<ul id="categories">
						<li><a href="#">Category Name</a></li>
						<li><a href="#">Category Name</a></li>
						<li><a href="#">Category Name</a></li>
						<li><a href="#">Category Name</a></li>
						<li><a href="#">Category Name</a></li>
					</ul>
				</li>
				<li>
					<a href="#archive" class="heading">Archive</a>
					<ul id="archive">
						<li><a href="#">January 2009</a></li>
						<li><a href="#">January 2009</a></li>
						<li><a href="#">January 2009</a></li>
						<li><a href="#">January 2009</a></li>
						<li><a href="#">January 2009</a></li>
					</ul>
				</li>
			</ul><!-- end accordion ul -->
		</div><!-- end accordion-container -->
		<h3>Latest Updates:</h3>
		<div id="curved-box" class="corner-this">
			<marquee onMouseOver=this.scrollAmount=0 onMouseOut=this.scrollAmount=2	scrollamount=2 direction="up">
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
				<p>This is a curved box where you can post latest news. Put up a slider or something.</p>
			</marquee>
		</div><!-- end curved box -->

	</div><!-- end sidebar -->
	<div id="content">
		This is a content box where you can post latest news. Put up a slider or something.
		This is a content box where you can post latest news. Put up a slider or something.
		This is a content box where you can post latest news. Put up a slider or something.
		This is a content box where you can post latest news. Put up a slider or something.
		This is a content box where you can post latest news. Put up a slider or something.
		This is a content box where you can post latest news. Put up a slider or something.
	</div><!-- end content -->
</div><!-- end content-container -->
<!-- End here -->
</div><!-- end container -->

In the above code: we opened a new container division in which we floated two divisions: a sidebar division to the left and a content division to the right. I gave the content division just a basic padding and then pasted in some gibberish text which we will remove the next time we start working on it. Then, In the sidebar container there are two main elements the accordion container inside which is an unordered list in which there is another unordered list inside each list item and then there a curved-box division inside which is a marquee tag which I don’t recommend using but I still have placed it there so the page looks a little more lively. I’d recommend a great slider you can use instead made with jQuery called Easy Slider. Now back to what we are making, below is my CSS code which is quite self explanatory as it is well commented.

#content-container{
	width:100%;
	height:auto;
	overflow:hidden; /* for clearing the floats inside it */
	float:left;
}
#sidebar{
	width:300px;
	margin-right:5px;
	float:left;
}
#sidebar h3{ /* these are the two headings. Products and Latest Updates */
	font-family:Arial;
	font-size:15px;
	color:#000;
	padding:10px;
}
#content{
	float:left;
	width:634px; /* because of 1px border to this element, else it would be 635px  */
	height:800px; /* temporary */
	padding:10px;
	background:#c4c4c4;
	border-bottom: 1px solid #444; /* temporary */
	border-left: 1px solid #444;
}
/* Accordion */
#accordion-container {
	width: 290px;
	margin:0 0 10px 7px; /* top right bottom left */
}
ul#accordion, ul#accordion ul { background:#f8f7f7; }
ul#accordion { border-bottom: 1px solid #444; }
ul#accordion li {
	border: 1px solid #444;
	border-bottom: none; /* to avoid double borders at bottom */
}
ul#accordion ul li {
	border: none; /* to remove the excess borders from previous properties */
	border-bottom: 1px solid #C2C8D1; /* and then put what we like. */
	padding: 5px 10px;  /* [top | bottom] [left | right] */
}
ul#accordion ul li:last-child { border-bottom: none; } /* to remove the borders from the last list element */
ul#accordion a.heading { /* the big menu names in the accordion */
	background: #d9d4ce;
	color: #46382f;
	display: block;
	font-size: 18px;
	line-height: 18px;
	padding: 10px 5px;
	text-decoration: none;
}
ul#accordion a.heading:hover { /* mouseover the big menu names in the accordion */
	background: #46382f;
	color: #fff;
}
ul#accordion li ul a { /* the inside-menu elements */
	color: #000;
	text-decoration:none;
}
ul#accordion li ul a:hover { border-bottom: 1px dotted #46382f; } /* to give the inside-menu elements mouseover */
/* End Accordion */
#curved-box{
	background:#d9d4ce;
	width:288px;
	height:205px;
	padding:10px;
	border:1px solid #444;
	margin:10px 0 10px 7px;
}
#curved-box p{
	margin-bottom:10px;
	padding-bottom:10px;
	border-bottom: 1px dotted #444;
}

Even though you have styled all the elements the accordion is not together and the curved box doesn’t have the curved corners yet. Not to worry we only have to write a few more lines of code to accomplish that. Right before the body tag we inserted our scripts, but if you look carefully we inserted three scripts and a fourth empty script tag with only a comment in it saying jQuery code here. Remove that comment and paste the code below in it’s place.

$(function(){
	$('#accordion').accordion();
	$('.corner-this').corner();
});

Refresh your page and play around with the accordion and admire the anti-aliased curved corners.

Also, I have started my community link feed as you can see in the sidebar (Thanks to Collis Ta’eed’s Great Tutorial) So please contribute to it. It takes less than a minute to submit a link there. So if you happen to have or know a link to a great tutorial or tip or a great article about web design & development please submit it here

Thank You

Links:

  • jQuery UI
  • Anti-Aliased Curved Corners – Blue Anvil
  • Easy Slider

Download the Source Code

Bookmark and Share
Like It?
Delicious Stumble Mixx Design Float
Visit Aayush Shastri's Website
 

No Comments Yet! Be the first to comment.

Comments currently closed.

Advertise Here Advertise Here
User Link Feed
  • 15 Essentials of a Successful Website with Examples

    When hundreds of web sites are designed up every other day, your website need to have something special to attract your potential customers.

  • 50+ Online Design Magazines

    Design magazines have always been a great source of inspiration for designers. It brings latest trends and new ideas into the mind of designers.

  • 40 Examples of Cool Javascript

    JavaScript has blossomed so rightly. Since then, there are jquery, Mootools , Scriptallicious, Prototype etc..which really produces cool effects. In todays time, java script is a must have component.

  • Invoicera Unveils its New Invoicing Application for Designers & Freelancers

    Invoicera has recently unveiled the release of their new fully blown web application with tons of powerful features to further simplify the management of bills and invoices. The new version is a complete makeover and you may probably even fail to recognize it.

  • Apple iPad- A New Way to Feel the Design World

    After literally years of speculation, Apple’s tablet is here and it’s called the iPad. iPad runs almost 140,000 apps from the App Store. It’s also a useful tool for designers, illustrators and digital artists looking to get creative on the move.

  • Top 60 Outstanding Photoshop Tutorials

    Again it’s time for photoshop tutorials. The tutorials are good as an inspiration for creative ideas. You have to learn how to combine photos and add special effects to turn a normal photograph into a stunning artwork.

  • 20+ Easy to Work Content Management Systems

    Choosing a CMS for your project depends upon the requirement and complexity of the project.

  • 40 + iPhone Apps for Designers and Developers

    The iPhone is more than just a phone. It combines three devices in one: a revolutionary phone, a wide screen iPod and a groundbreaking Internet device.

  • 14 Best CSS Editors for Web Designers & Developers

    CSS definitely provides you the ease of changing the appearance of your entire website by just modifying a single file. What makes the entire process of changing the CSS files more easy is the use of CSS Editors.BestDesignTuts.com has brought to you 14 such CSS Editors which will cut half of the work load of every designer.

  • 404! With a Difference…

    404! Error Pages once used to be seen as the most unwanted page that any visitor would like to see, and therefore the designers did not give the required piece of attention to it.

SubcribeSubmit a Link
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
  • Recent Posts

    • Top 10 Must Follow Web Blogs + 6 Web News Repositories
    • Image Flip Using jQuery
    • New Author + Resources Category on WebMuch!
    • Animated Navigation Bar Using jQuery
    • How & why you should use Google CDN
  • Categories

    • Articles
    • HTML & CSS
    • JavaScript & AJAX
    • News
    • PHP
    • Round-ups
    • Tutorials
WebMuch Home
© Copyrights 2009

Other Projects:

PicMuch