Skip to content

Basic usage of Presentation.js

holyshared edited this page Jan 19, 2012 · 10 revisions

Basic usage of Presentation.js

The directions for Presentation.js are explained.
It can be used easily.

Step1. Creation of a html template.

<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Presentation.js</title>
        <meta name="description" content="" />
        <meta name="keywords" content="" />
    </head>
    <body>

        <article id="presentation" class="presentation">

            <header class="header">
                <h1>Presentation.js</h1>
            </header>

            <!-- Page container -->
            <article data-presentation-role="container" class="container">

                <!-- Page1 -->
                <section data-presentation-role="content" class="content">
                    <hgroup>
                        <h2>Page1 title</h2>
                        <h3>Page sub title</h3>
                    </hgroup>
                    <p>page content</p>
                </section>

                <!-- Page2 -->
                <section data-presentation-role="content" class="content">
                    <hgroup>
                        <h2>Page2 title</h2>
                        <h3>Page sub title</h3>
                    </hgroup>
                    <p>page content</p>
                </section>

            </article>

            <!-- Controller helper plugin -->
            <div class="controller">
                <button title="First" type="button" class="first disabled">first</button>
                <button title="Prev" type="button" class="prev disabled">prev</button>
                <button title="Next" type="button" class="next">next</button>
                <button title="Last" type="button" class="last">last</button>
            </div>
            <!-- /Controller helper plugin -->

            <!-- Page helper plugin -->
            <div class="page">
                <span class="current"></span> / <span class="total"></span>
            </div>
            <!-- /Page helper plugin -->

            <footer class="footer">
                <p class="copyright">Copyright 2012 <a title="Your name" href="#">Your name</a> all rights reserved.</p>
            </footer>

        </article>

    </body>
</html>

Step2. Creation of a stylesheet

Step3. Reading of a javascript file

A required library is read.

Here, presentation-standard.js is read.
Please have a look here about the specification of presentation-standard.js.

<script src="js/lib/mootools/mootools-core-1.4.2.js"></script>
<script src="js/lib/presentation/presentation-standard.js"></script>

Step4. The javascript code is written.

There are not many codes which must be described to make it actually operate.
Plugin to use is registered and a start method is only performed.

(function(plugins){

this.addEvent('domready', function(){

    var p = new Presentation('presentation');

    p.addHelper(new plugins.Controller()) //GUI controller helper plugin enabled.
        .addHelper(new plugins.Keyboard())  //Keyboard operation is enabled. 
        .addHelper(new plugins.Page()); //Page helper plugin is enabled.

    p.displayFullScreen()   //It displays on a full screen.
        .start(); //presentation.js is started.

});

}.call(this, Presentation.Helper));

Clone this wiki locally