首先看一下演示效果:演示地址
是国外程序员的开源js库,我做了一个简单的ppt放在网上,下面是使用教程,原文是英文的,下面是我翻译的哦。reveal.js
复制代码
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - The HTML Presentation Frameworktitle>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<link rel="stylesheet" href="lib/css/zenburn.css">
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
script>
head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Reveal.jsh1>
<h3>HTML展现ppt效果的框架h3>
<p>
<small>Created by <a href="http://hakim.se">Hakim El Hattaba> / <a href="http://twitter.com/hakimel">@hakimela>small>
p>
section>
<section>
<h2>概述h2>
<p>
reveal.js 能让你用HTML构建漂亮的交互式幻灯片。这个页面将会告诉你怎么做!
p>
section>
<section>
<section>
<h2>垂直幻灯片h2>
<p>幻灯片可以相互嵌套p>
<p>用 <em>spaceem> 键播放幻灯片 p>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
a>
section>
<section>
<h2>地下1层h2>
<p> 嵌套幻灯片可以添加额外的详细信息,下面是有用的高水平下滑 p>
section>
<section>
<h2>地下2层h2>
<p>现在,是时候往上了p>
<a href="#/2">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Up arrow" style="transform: rotate(180deg); -webkit-transform: rotate(180deg);">
a>
section>
section>
<section>
<h2>幻灯片h2>
<p>
不是程序员? 没关系,这里有可视化界面编辑的网站 <a href="http://slides.com" target="_blank">http://slides.coma>.
p>
section>
<section>
<h2>视图焦点h2>
<p>
点击 <strong>ESCstrong> 可以查看幻灯片的综述
p>
<p>
按住 Alt 不放,单击鼠标左键到屏幕 <a href="http://lab.hakim.se/zoom-js">这里a>。Alt + 单击鼠标左键到屏幕任意位置返回。
p>
section>
<section>
<h2>触摸优化h2>
<p>
ppt在触摸设备上看起来效果很好,比如手机和平板电脑。简单的滑动幻灯片。
p>
section>
<section data-markdown>
<script type="text/template">
## Markdown 支持
使用内部或外部Markdown编辑内容。在 [readme](https://github.com/hakimel/reveal.js#markdown)查看更多信息。
```
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).
</section>
```
script>
section>
<section>
<section id="fragments">
<h2>Fragmentsh2>
<p>点击下一个箭头...p>
<p class="fragment">... 下一步 ...p>
<p><span class="fragment">... aspan> <span class="fragment">fragmentedspan> <span class="fragment">slide.span>p>
<aside class="notes">
This slide has fragments which are also stepped through in the notes window.
aside>
section>
<section>
<h2>Fragment 样式h2>
<p>有许多不同样式的 fragments, 比如:p>
<p class="fragment grow">growp>
<p class="fragment shrink">shrinkp>
<p class="fragment fade-out">fade-outp>
<p class="fragment current-visible">current-visiblep>
<p class="fragment highlight-red">highlight-redp>
<p class="fragment highlight-blue">highlight-bluep>
section>
section>
<section id="transitions">
<h2>过渡样式h2>
<p>
你可以选择不同的过渡样式, 比如:
<a href="?transition=none#/transitions">Nonea> -
<a href="?transition=fade#/transitions">Fadea> -
<a href="?transition=slide#/transitions">Slidea> -
<a href="?transition=convex#/transitions">Convexa> -
<a href="?transition=concave#/transitions">Concavea> -
<a href="?transition=zoom#/transitions">Zooma>
p>
section>
<section id="themes">
<h2>主题h2>
<p>
reveal.js 有如下主题可选:
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/black.css'); return false;">Black (default)a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/white.css'); return false;">Whitea> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/league.css'); return false;">Leaguea> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/sky.css'); return false;">Skya> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/beige.css'); return false;">Beigea> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/simple.css'); return false;">Simplea>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/serif.css'); return false;">Serifa> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/blood.css'); return false;">Blooda> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/night.css'); return false;">Nighta> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/moon.css'); return false;">Moona> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/solarized.css'); return false;">Solarizeda>
p>
section>
<section>
<section data-background="#dddddd">
<h2>背景h2>
<p>
设置 <code>data-background="#dddddd"code> 改变ppt的背景颜色. 所有CSS颜色标签都支持。
p>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
a>
section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png">
<h2>图片背景h2>
<pre><code class="hljs"><section data-background="image.png">code>pre>
section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png" data-background-repeat="repeat" data-background-size="100px">
<h2>平铺的图片背景h2>
<pre><code class="hljs" style="word-wrap: break-word;"><section data-background="image.png" data-background-repeat="repeat" data-background-size="100px">code>pre>
section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-color="#000000">
<div style="background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px;">
<h2>视频背景h2>
<pre><code class="hljs" style="word-wrap: break-word;"><section data-background-video="video.mp4,video.webm">code>pre>
div>
section>
<section data-background="http://i.giphy.com/90F8aUepslB84.gif">
<h2>GIF图片背景!h2>
section>
section>
<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
<h2>背景过渡h2>
<p>
可以选择不同的背景过渡,下面这种是 "zoom".
p>
<pre><code class="hljs">Reveal.configure({ backgroundTransition: 'zoom' })code>pre>
section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="zoom">
<h2>背景过渡h2>
<p>
你可以给每一页ppt设置不同的背景过渡.
p>
<pre><code class="hljs" style="word-wrap: break-word;"><section data-background-transition="zoom">code>pre>
section>
<section>
<h2>漂亮的代码样式h2>
<pre><code class="hljs" data-trim contenteditable>
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i < len; i++ ) {
var node = nodes<i>;
if( !node.className ) {
node.className += ' roll';
}
}
}
}
code>pre>
<p>语法高亮的代码<a href="http://softwaremaniacs.org/soft/highlight/en/description/">highlight.jsa>.p>
section>
<section>
<h2>无序列表h2>
<ul>
<li>No order hereli>
<li>Or hereli>
<li>Or hereli>
<li>Or hereli>
ul>
section>
<section>
<h2>有序列表h2>
<ol>
<li>One is smaller than...li>
<li>Two is smaller than...li>
<li>Three!li>
ol>
section>
<section>
<h2>表格h2>
<table>
<thead>
<tr>
<th>物品th>
<th>价格th>
<th>数量th>
tr>
thead>
<tbody>
<tr>
<td>苹果td>
<td>$1td>
<td>7td>
tr>
<tr>
<td>柠檬td>
<td>$2td>
<td>18td>
tr>
<tr>
<td>面包td>
<td>$3td>
<td>2td>
tr>
tbody>
table>
section>
<section>
<h2>引用h2>
<p>
有两种形式的引用, 内联的: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
“The nice thing about standards is that there are so many to choose from”q>
p>和成块的引用:
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
“For years there has been a theory that millions of monkeys typing at random on millions of typewriters would reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.”
blockquote>
section>
<section>
<h2>链接跳转h2>
<p>
你可以链接跳转到ppt内部的某一页,
<a href="#/2/3">点击这里a>.
p>
section>
<section>
<h2>演讲者模式h2>
<p>这里有一种<a href="https://github.com/hakimel/reveal.js#speaker-notes">演讲者模式a>. 它包括计时器, 预览即将到来的下一页ppt或者笔记.p>
<p>按住 <em>sem> 试一试.p>
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
aside>
section>
<section>
<h2>输出pdfh2>
<p>可以输出 <a href="https://github.com/hakimel/reveal.js#pdf-export">PDFa>,下面是例子:p>
<iframe src="https://www.slideshare.net/slideshow/embed_code/42840540" width="445" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:3px solid #666; margin-bottom:5px; max-width: 100%;" allowfullscreen> iframe>
section>
<section>
<h2>全局状态h2>
<p>
设置 <code>data-state="something"code> 在ppt上 <code>"something"code>
会在ppt打开的时候作为一个class加到每一个文件元素里.
p>
section>
<section data-state="customevent">
<h2>状态事件h2>
<p>
另外可以触发自定义事件绑定在每张幻灯片的上的 <code>data-statecode> 值.
p>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
Reveal.addEventListener( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
code>pre>
section>
<section>
<h2>花点时间h2>
<p>
点击 B 或者 . 暂停演示.
p>
section>
<section>
<h2>更多支持h2>
<ul>
<li><a href="https://github.com/hakimel/reveal.js#api">Extensive JavaScript APIa>li>
<li><a href="https://github.com/hakimel/reveal.js#auto-sliding">自动播放a>li>
<li><a href="https://github.com/hakimel/reveal.js#parallax-background">Parallax backgroundsa>li>
<li><a href="https://github.com/hakimel/reveal.js#keyboard-bindings">自定义键盘绑定a>li>
ul>
section>
<section style="text-align: left;">
<h1>结束h1>
<p>
- <a href="http://slides.com">试试在线编辑器a>
- <a href="https://github.com/hakimel/reveal.js">源代码 & 文件a>
p>
section>
div>
div>
<script src="lib/js/head.min.js">script>
<script src="js/reveal.js">script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
script>
body>
html>i>