Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 070a68feb96ff28c4ad0657b437e666c2c1df12f @chriscoyier chriscoyier committed Dec 1, 2011
Showing with 291 additions and 0 deletions.
  1. +57 −0 about.html
  2. +54 −0 contact.html
  3. +70 −0 css/style.css
  4. +60 −0 index.html
  5. +41 −0 js/dynamicpage.js
  6. +9 −0 js/jquery.ba-hashchange.min.js
57 about.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
+
+ <title>Dynamic Page | About</title>
+
+ <link rel='stylesheet' type='text/css' href='css/style.css' />
+
+ <!--[if IE]>
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
+ <script type='text/javascript' src='js/dynamicpage.js'></script>
+</head>
+
+<body>
+
+ <?php include('../header.php'); ?>
+
+ <div id="page-wrap">
+
+ <header>
+ <h1>Dynamic Site</h1>
+
+ <nav>
+ <ul class="group">
+ <li><a href="index.html">Home</a></li>
+ <li><a href="about.html">About</a></li>
+ <li><a href="contact.html">Contact</a></li>
+ </ul>
+ </nav>
+ </header>
+
+ <section id="main-content">
+ <div id="guts">
+
+ <h2>About</h2>
+
+ <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
+
+ </div>
+ </section>
+
+ <footer>
+ &copy;2010 CSS-Tricks
+ </footer>
+
+ </div>
+
+ <?php include('../footer.php'); ?>
+
+</body>
+
+</html>
54 contact.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
+
+ <title>Dynamic Page | Contact</title>
+
+ <link rel='stylesheet' type='text/css' href='css/style.css' />
+
+ <!--[if IE]>
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
+ <script type='text/javascript' src='js/dynamicpage.js'></script>
+</head>
+
+<body>
+
+ <?php include('../header.php'); ?>
+
+ <div id="page-wrap">
+
+ <header>
+ <h1>Dynamic Page</h1>
+
+ <nav>
+ <ul class="group">
+ <li><a href="index.html">Home</a></li>
+ <li><a href="about.html">About</a></li>
+ <li><a href="contact.html">Contact</a></li>
+ </ul>
+ </nav>
+ </header>
+
+ <section id="main-content">
+ <div id="guts">
+
+<iframe height="517" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="https://chriscoyier.wufoo.com/embed/s7p1p9/"><a href="https://chriscoyier.wufoo.com/forms/s7p1p9/" title="Example Form" rel="nofollow">Fill out my Wufoo form!</a></iframe>
+ </div>
+ </section>
+
+ </div>
+
+ <footer>
+ &copy;2010 CSS-Tricks
+ </footer>
+
+ <?php include('../footer.php'); ?>
+
+</body>
+
+</html>
70 css/style.css
@@ -0,0 +1,70 @@
+/*
+ CSS-Tricks Example
+ by Chris Coyier
+ http://css-tricks.com
+*/
+
+* { margin: 0; padding: 0; }
+html { overflow-y: scroll; }
+body { font: 12px/1.4 Helvetica, sans-serif; background: #333; color: #333; }
+.group:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
+.group { display: inline-block; clear: both; }
+/* start commented backslash hack \*/ * html .group { height: 1%; } .group { display: block; } /* close commented backslash hack */
+article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; }
+a:focus { outline: 0; }
+
+#page-wrap {
+ width: 500px; margin: 40px auto 5px; background: #91c7ff;
+ padding: 8px;
+ background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc));
+ background: -moz-linear-gradient(top, #eee, #ccc);
+ -webkit-border-radius: 16px;
+ -moz-border-radius: 16px;
+}
+
+#main-content { padding: 14px; }
+
+h1 { font: bold 32px Helvetica, Arial, Sans-Serif; letter-spacing: -1px; padding: 14px; color: #333; text-shadow: 1px 1px 1px white; }
+p { margin: 0 0 15px 0; }
+
+nav ul {
+ list-style: none; background: #154c85; padding: 5px 20px; width: 478px; position: relative;
+ left: -9px;
+}
+nav ul li { display: inline; }
+nav ul li a {
+ display: block;
+ float: left;
+ border-top: 1px solid #96d1f8;
+ background: #3e779d;
+ background: -webkit-gradient(linear, left top, left bottom, from(#65a9d7), to(#3e779d));
+ background: -moz-linear-gradient(top, #65a9d7, #3e779d);
+ height: 17px;
+ padding: 0 10px;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ border-radius: 8px;
+ -webkit-box-shadow: rgba(0,0,0,1) 0 1px 3px;
+ -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
+ text-shadow: rgba(0,0,0,.4) 0 1px 0;
+ -webkit-text-stroke: 1px transparent;
+ font: bold 11px/16px "Lucida Grande", "Verdana", sans-serif;
+ color: rgba(255,255,255,.85);
+ text-decoration: none;
+ margin: 0 5px 0 0;
+}
+nav ul li a:hover {
+ border-top: 1px solid #4789b4;
+ background: #28597a;
+ background: -webkit-gradient(linear, left top, left bottom, from(#3d789f), to(#28597a));
+ background: -moz-linear-gradient(top, #3d789f, #28597a);
+ color: rgba(255,255,255,.85);
+}
+nav ul li a:active, nav ul li a.current {
+ border-top-color: #245779;
+ background: #1b435e;
+ position: relative;
+ top: 1px;
+}
+
+footer { color: #999; margin: 0 auto; width: 500px; }
60 index.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
+
+ <title>Dynamic Page | Home</title>
+
+ <link rel='stylesheet' type='text/css' href='css/style.css' />
+
+ <!--[if IE]>
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
+ <script type='text/javascript' src='js/jquery.ba-hashchange.min.js'></script>
+ <script type='text/javascript' src='js/dynamicpage.js'></script>
+</head>
+
+<body>
+
+ <?php include('../header.php'); ?>
+
+ <div id="page-wrap">
+
+ <header>
+ <h1>Dynamic Page</h1>
+
+ <nav>
+ <ul class="group">
+ <li><a href="index.html">Home</a></li>
+ <li><a href="about.html">About</a></li>
+ <li><a href="contact.html">Contact</a></li>
+ </ul>
+ </nav>
+ </header>
+
+ <section id="main-content">
+ <div id="guts">
+
+ <h2>Home</h2>
+
+ <p>Pellentesque habitant morbi tristique senectus et netus et malesuada. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
+
+ <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
+
+ </div>
+ </section>
+
+ </div>
+
+ <footer>
+ &copy;2010 CSS-Tricks
+ </footer>
+
+ <?php include('../footer.php'); ?>
+
+</body>
+
+</html>
41 js/dynamicpage.js
@@ -0,0 +1,41 @@
+$(function() {
+
+ var newHash = "",
+ $mainContent = $("#main-content"),
+ $pageWrap = $("#page-wrap"),
+ baseHeight = 0,
+ $el;
+
+ $pageWrap.height($pageWrap.height());
+ baseHeight = $pageWrap.height() - $mainContent.height();
+
+ $("nav").delegate("a", "click", function() {
+ window.location.hash = $(this).attr("href");
+ return false;
+ });
+
+ $(window).bind('hashchange', function(){
+
+ newHash = window.location.hash.substring(1);
+
+ if (newHash) {
+ $mainContent
+ .find("#guts")
+ .fadeOut(200, function() {
+ $mainContent.hide().load(newHash + " #guts", function() {
+ $mainContent.fadeIn(200, function() {
+ $pageWrap.animate({
+ height: baseHeight + $mainContent.height() + "px"
+ });
+ });
+ $("nav a").removeClass("current");
+ $("nav a[href="+newHash+"]").addClass("current");
+ });
+ });
+ };
+
+ });
+
+ $(window).trigger('hashchange');
+
+});
9 js/jquery.ba-hashchange.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery hashchange event - v1.2 - 2/11/2010
+ * http://benalman.com/projects/jquery-hashchange-plugin/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);

0 comments on commit 070a68f

Please sign in to comment.
Something went wrong with that request. Please try again.