Browse Source

add theme config option, add sky theme, fix line-height of <small>

Hakim El Hattab 11 years ago
parent
commit
90f343e5bd
5 changed files with 57 additions and 4 deletions
  1. 2 1
      css/main.css
  2. 27 0
      css/theme/sky.css
  3. 18 1
      index.html
  4. 9 1
      js/reveal.js
  5. 1 1
      js/reveal.min.js

+ 2 - 1
css/main.css

@@ -233,8 +233,9 @@ body {
 }
 
 .reveal small {
+	display: inline-block;
 	font-size: 0.6em;
-	line-height: 1em;
+	line-height: 1.2em;
 	vertical-align: top;
 }
 

File diff suppressed because it is too large
+ 27 - 0
css/theme/sky.css


+ 18 - 1
index.html

@@ -15,7 +15,7 @@
 		<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
 		
 		<link rel="stylesheet" href="css/main.css">
-		<link rel="stylesheet" href="css/theme/default.css">
+		<link rel="stylesheet" href="css/theme/default.css" id="theme">
 
 		<!-- For syntax highlighting -->
 		<link rel="stylesheet" href="lib/css/zenburn.css">
@@ -151,6 +151,22 @@
 					</ul>
 				</section>
 
+				<section>
+					<h2>Themes</h2>
+					<p>
+						Reveal.js comes with a few themes built in: <br>
+						<a href="http://lab.hakim.se/reveal-js/?theme=sky">Sky</a> |
+						<a href="http://lab.hakim.se/reveal-js/?theme=beige">Beige</a> |
+						<a href="http://lab.hakim.se/reveal-js/?theme=simple">Simple</a> |
+						<a href="http://lab.hakim.se/reveal-js/">Default</a>
+					</p>
+					<p>
+						<small>
+							* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <code>&lt;head&gt;</code> using a <code>&lt;link&gt;</code>.
+						</small>
+					</p>
+				</section>
+
 				<section>
 					<section data-state="alert">
 						<h2>Global State</h2>
@@ -296,6 +312,7 @@ function linkify( selector ) {
 				progress: true,
 				history: true,
 				
+				theme: Reveal.getQueryHash().theme || 'default', // available themes are in /css/theme
 				transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
 
 				// Optional libraries used to extend on reveal.js

+ 9 - 1
js/reveal.js

@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.0 r20
+ * reveal.js 2.0 r21
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
@@ -39,6 +39,9 @@ var Reveal = (function(){
 			// Apply a 3D roll to links on hover
 			rollingLinks: true,
 
+			// Transition style (see /css/theme)
+			theme: 'default', 
+
 			// Transition style
 			transition: 'default', // default/cube/page/concave/linear(2d),
 
@@ -111,6 +114,7 @@ var Reveal = (function(){
 		extend( config, options );
 
 		// Cache references to DOM elements
+		dom.theme = document.querySelector( '#theme' );
 		dom.wrapper = document.querySelector( '.reveal' );
 		dom.progress = document.querySelector( '.reveal .progress' );
 		dom.progressbar = document.querySelector( '.reveal .progress span' );
@@ -222,6 +226,10 @@ var Reveal = (function(){
 			dom.progress.style.display = 'block';
 		}
 
+		if( config.theme && dom.theme ) {
+			dom.theme.setAttribute( 'href', 'css/theme/' + config.theme + '.css' );
+		}
+
 		if( config.transition !== 'default' ) {
 			dom.wrapper.classList.add( config.transition );
 		}

File diff suppressed because it is too large
+ 1 - 1
js/reveal.min.js


Some files were not shown because too many files changed in this diff