cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra

Youtube-like Adaptable View Using CSS and jQuery

Here’s a nice creation by Janko that mimics a Youtube-like adaptable change view feature. This lets you switch between normal mode and wide mode making it expand or shrink the movie area. Although it changes view, all the information still remains accessible.

In simulating the structure, five sections are defined – content, comments, sidebar and footer. Here is the structure.

<div id="header"></div>
<div id="main">
<div id="content"></div>
<div id="sidebar"></div>
<div id="comments"></div>
<div id="footer"></div>

For the content and comment areas to float to the left and sidebar floating to the right, here is its CSS.

#header, #content, #comments, #sidebar, #footer { margin:10px 0px; padding:30px;}
#header { width:900px; margin:0px auto;}
#main {width:960px; margin:0px auto; overflow:hidden;}
#content { width:540px; float:left;}
#comments { width:540px; float:left;}
#sidebar { width:280px; margin-left:20px; float:right;}
#footer { width:900px; margin:0px auto;}

For the content, it will be 600px wide paddings included and when the user changes to wide view, it will stretch to 960px. Below is the code to create textual link.

<a id="wideView" href="#">Change View</a>

Interaction. Below is the jQuery that will toggle the CSS class ‘wide’.

$(document).ready(function() {
    $("#wideView").click(function() {

Setting ‘wide’ CSS class to 900px (with paddings, it will be 960px total)

#content.wide { width:900px;}  

You can check out the full info by clicking on the image.

See the live DEMO here.

Related Posts

BizFlare Corporate WordPress Theme

Garnet Creative Portfolio Theme

How to Style Nav Links Using Floats With HTML5 and CSS3

10 Great jQuery Plugins for November 2013

No comments