Created
July 19, 2013 01:06
-
-
Save sivagao/6034340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#content a').each(function () { | |
$('<div class="fader" />').css('opacity', 0).prependTo(this); | |
}).hover(function () { | |
$('img', this).stop().animate({ | |
marginLeft : 5 | |
}, 250); | |
$('.fader', this).stop().animate({ | |
opacity : 0.15 | |
}); | |
}, function () { | |
$('img', this).stop().animate({ | |
marginLeft : 10 | |
}, 250); | |
$('.fader', this).stop().animate({ | |
opacity : 0 | |
}); | |
}).find('img').css('marginLeft', 10); | |
$('.navigation').each(function () { | |
var $links = $(this).find('a'), | |
panelIds = $links.map(function() { return this.hash; }).get().join(","), | |
$panels = $(panelIds), | |
$panelwrapper = $panels.filter(':first').parent(), | |
delay = 500, | |
heightOffset = 40; // we could add margin-top + margin-bottom + padding-top + padding-bottom of $panelwrapper | |
$panels.hide(); | |
$links.click(function () { | |
var link = this, | |
$link = $(this); | |
// ignore if already visible | |
if ($link.is('.selected')) { | |
return false; | |
} | |
$links.removeClass('selected'); | |
$link.addClass('selected'); | |
document.title = 'jQuery look: Tim Van Damme - ' + $link.text(); | |
if ($.support.opacity) { | |
$panels.stop().animate({opacity: 0 }, delay); | |
} | |
$panelwrapper.stop().animate({ | |
height: 0 | |
}, delay, function () { | |
var height = $panels.hide().filter(link.hash).css('opacity', 1).show().height() + heightOffset; | |
$panelwrapper.animate({ | |
height: height | |
}, delay); | |
}); | |
}); | |
$links.filter(window.location.hash ? '[hash=' + window.location.hash + ']' : ':first').click(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: "Lucida Grande",Verdana,sans-serif; | |
font-size: 11px; | |
line-height: 16px; | |
padding: 10px; | |
} | |
h2 { | |
margin-top: 0; | |
} | |
#wrapper { | |
width: 470px; | |
margin: 0 auto; | |
} | |
#content { | |
padding: 0 10px; | |
background: url(images/content.png) repeat-y; | |
} | |
#content ul { | |
float: left; | |
display: block; | |
width: 450px; | |
margin: 0; | |
padding: 0; | |
background: url(images/networks.png) repeat; | |
list-style: none; | |
} | |
#content li { | |
float: left; | |
height: 60px; | |
width: 225px; | |
position: relative; | |
} | |
#content a { | |
font-size: 1em; | |
color: #666; | |
text-decoration: none; | |
padding: 10px 0 5px; | |
display: block; | |
width: 225px; | |
height: 45px; | |
position: relative; | |
z-index: 2; | |
} | |
a img { | |
border: 0; | |
float: left; | |
margin: 0 10px; | |
} | |
.fader { | |
opacity: 0; | |
-moz-opacity: 0; | |
filter:alpha(opacity=0); | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 60px; | |
background-color: #A4ADB7; | |
} | |
a:hover img { | |
margin-left: 5px; | |
} | |
a strong { | |
display: block; | |
font-size: 18px; | |
color: #000; | |
} | |
.clear { | |
clear: left; | |
} | |
#datacontent { | |
padding: 20px 10px; | |
} | |
#datacontent ul { | |
list-style: none; | |
margin: 0; | |
padding: 5px; | |
display: block; | |
height: 30px; | |
background: #DFDFDF; | |
-moz-border-radius-topleft: 10px; | |
-moz-border-radius-topright: 10px; | |
-webkit-border-top-left-radius: 10px; | |
-webkit-border-top-right-radius: 10px; | |
} | |
#datacontent li { | |
float: left; | |
} | |
#datacontent li a { | |
outline: 0; | |
display: block; | |
background: #DFDFDF; | |
color: #666; | |
text-decoration: none; | |
padding: 1px 5px; | |
margin: 5px; | |
border: 1px solid #DFDFDF; | |
} | |
#datacontent li a:hover { | |
border: 1px solid #D1D1D1; | |
background: #D1D1D1; | |
color: #000; | |
-moz-border-radius: 10px; | |
-webkit-border-radius: 10px; | |
} | |
#datacontent li a.selected { | |
background: #AFAFAF; | |
-moz-border-radius: 10px; | |
-webkit-border-radius: 10px; | |
border: 1px inset #fff; | |
color: #fff; | |
} | |
#datacontent .panels { | |
border: 1px solid #DFDFDF; | |
border-top: 0; | |
border-bottom: 10px solid #DFDFDF; | |
-moz-border-radius-bottomleft: 10px; | |
-moz-border-radius-bottomright: 10px; | |
-webkit-border-bottom-right-radius: 10px; | |
-webkit-border-bottom-left-radius: 10px; | |
overflow: hidden; | |
} | |
#datacontent .panelsInner { | |
overflow: hidden; | |
} | |
#datacontent .panel { | |
padding: 20px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>jQuery look: Tim Van Damme</title> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<link rel="stylesheet" href="style.css" /> | |
<!--[if IE]> | |
<style type="text/css" media="screen"> | |
div, | |
li { | |
zoom: 1; | |
} | |
</style> | |
<![endif]--> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<div id="content"> | |
<ul> | |
<li><a href="http://twitter.com/maxvoltar"><img src="images/twitter.png" /><strong>Twitter</strong> twitter.com/maxvoltar</a></li> | |
<li><a href="http://flickr.com/photos/maxvoltar"><img src="images/flickr.png" /><strong>Flickr</strong> flickr.com/photos/maxv…</a></li> | |
<li><a href="http://twitter.com/rem"><img src="images/twitter.png" /><strong>Twitter</strong> twitter.com/rem</a></li> | |
<li><a href="http://flickr.com/photos/maxvoltar"><img src="images/flickr.png" /><strong>Flickr</strong> flickr.com/photos/maxv…</a></li> | |
<li><a href="http://twitter.com/jquery"><img src="images/twitter.png" /><strong>Twitter</strong> twitter.com/jquery</a></li> | |
<li><a href="http://flickr.com/photos/maxvoltar"><img src="images/flickr.png" /><strong>Flickr</strong> flickr.com/photos/maxv…</a></li> | |
<li><a href="http://twitter.com/jeresig"><img src="images/twitter.png" /><strong>Twitter</strong> twitter.com/jeresig</a></li> | |
<li><a href="http://flickr.com/photos/maxvoltar"><img src="images/flickr.png" /><strong>Flickr</strong> flickr.com/photos/maxv…</a></li> | |
</ul> | |
<div class="clear"></div> | |
</div> | |
<div id="datacontent"> | |
<ul class="navigation"> | |
<li><a href="#networks">Networks</a></li> | |
<li><a href="#about">About</a></li> | |
<li><a href="#contact">Contact</a></li> | |
</ul> | |
<div class="panels"> | |
<div id="networks" class="panel"> | |
<h2>Networks</h2> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
<div id="about" class="panel"> | |
<h2>About</h2> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
<div id="contact" class="panel"> | |
<h2>Contact</h2> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment