无法得到impress.js工作

时间:2013-05-15 08:32:13

标签: javascript impress.js

我尝试从impress.js开始创建一些HTML / CSS3演示文稿 不幸的是,即使是最简单的例子也无法工作。

<html lang="en">
<head>
    <title>Impress Demo</title>
</head>
<body>
    <div id="impress">
        <div id="start">
            <p style='width:1000px;font-size:80px;text-align:center'>Creating Stunning Visualizations</p>
            <p>Impress.js</p>
        </div>

        <div id="slide2" data-x="-1200" data-y="0">
            <p style='width:1000px;font-size:80px;'>First Slide Moves From Left To Right</p>
            <p>Impress.js</p>
        </div>
    </div>

    <script type="text/javascript" src="../js/impress.js"></script>
    <script type="text/javascript">impress().init();</script>
</body>

Howver,在Firefox中(也在Chrome中测试过)我在开发控制台中收到以下错误:

Empty string passed to getElementById() @ impress.js:90

有什么想法吗?

1 个答案:

答案 0 :(得分:4)

您希望成为div#impress中某个步骤的每个div都应添加class="step"

此代码应该可以使用

<div id="impress">
    <div class="step" id="start">
        <p style='width:1000px;font-size:80px;text-align:center'>Creating Stunning Visualizations</p>
        <p>Impress.js</p>
    </div>

    <div class="step" id="slide2" data-x="-1200" data-y="0">
        <p style='width:1000px;font-size:80px;'>First Slide Moves From Left To Right</p>
        <p>Impress.js</p>
    </div>
</div>