Permalink
Browse files

Made JavaScript unobtrusive by factoring out prettyPrint() to applica…

…tion.js. Also removed unused class from hero demo.
  • Loading branch information...
1 parent cf47ef0 commit 0a34a6d4b2131d28ed3d09857c2ccf78f139f837 @karthikv karthikv committed Aug 26, 2011
Showing with 18 additions and 6 deletions.
  1. +14 −2 docs/assets/js/application.js
  2. +2 −2 docs/index.html
  3. +2 −2 examples/hero.html
@@ -1,10 +1,22 @@
$(document).ready(function(){
+ // Google code prettify
+ // ================
+
+ // cache $(window), as it is used in scroll spy logic later on
+ var $window = $(window);
+
+ $window.load(function() {
+ // prettyPrint cannot be set as the event handler to load directly; see
+ // http://google-code-prettify.googlecode.com/svn/trunk/README.html
+ prettyPrint();
+ });
+
+
// scroll spy logic
// ================
var activeTarget,
- $window = $(window),
position = {},
nav = $('body > .topbar li a'),
targets = nav.map(function () {
@@ -127,4 +139,4 @@ $(document).ready(function(){
});
-});
+});
View
@@ -29,7 +29,7 @@
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
- <body onload="prettyPrint();">
+ <body>
<!-- Topbar
================================================== -->
@@ -1383,4 +1383,4 @@ <h3 class="title">Popover Title</h3>
</div>
</body>
-</html>
+</html>
View
@@ -25,7 +25,7 @@
<div class="topbar">
<div class="fill">
- <div class="container fixed">
+ <div class="container">
<h3><a href="#">Project name</a></h3>
<ul>
<li class="active"><a href="#">Home</a></li>
@@ -71,4 +71,4 @@
</div> <!-- /container -->
</body>
-</html>
+</html>

0 comments on commit 0a34a6d

Please sign in to comment.