diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-18 20:15:46 +0000 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-18 20:15:46 +0000 |
commit | b3d680eab461db09db537e9da26e601ce59b84ad (patch) | |
tree | 9647e508c2dd0fcdf7321a7f23a3170973cc544b | |
parent | b0c5644b475a09704ea010025b491fd9211122c3 (diff) | |
download | impress.js-b3d680eab461db09db537e9da26e601ce59b84ad.tar.gz |
lowercase event names to keep DOM events convention, with backbone-style impress: namespace - in courtesy of @medikoo
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | js/impress.js | 18 |
2 files changed, 11 insertions, 11 deletions
@@ -29,10 +29,10 @@ VERSION HISTORY * API changed, so that `impress()` function no longer automatically initialize presentation; new method called `init` was added to API and it should be used to start the presentation -* event `impress-init` is triggered on root presentation element (`#impress` by default) when presentation is initialized +* event `impress:init` is triggered on root presentation element (`#impress` by default) when presentation is initialized * new CSS classes were added: `impress-disabled` is added to body element by the impress.js script and it's changed to `impress-enabled` when `init()` function is called -* events added when step is entered and left - custom `impress-step-enter` and `impress-step-leave` events are triggered +* events added when step is entered and left - custom `impress:stepenter` and `impress:stepleave` events are triggered on step elements and can be handled like any other DOM events (with `addEventListener`) * additional `past`, `present` and `future` classes are added to step elements - `future` class appears on steps that were not yet visited diff --git a/js/impress.js b/js/impress.js index 7c1b289..e23c637 100644 --- a/js/impress.js +++ b/js/impress.js @@ -226,14 +226,14 @@ var lastEntered = null; var onStepEnter = function (step) { if (lastEntered !== step) { - triggerEvent(step, "impress-step-enter"); + triggerEvent(step, "impress:stepenter"); lastEntered = step; } }; var onStepLeave = function (step) { if (lastEntered === step) { - triggerEvent(step, "impress-step-leave"); + triggerEvent(step, "impress:stepleave"); } }; @@ -353,7 +353,7 @@ initialized = true; - triggerEvent(root, "impress-init", { api: roots[ "impress-root-" + rootId ] }); + triggerEvent(root, "impress:init", { api: roots[ "impress-root-" + rootId ] }); }; var getStep = function ( step ) { @@ -462,26 +462,26 @@ return goto(next); }; - root.addEventListener("impress-init", function(){ + root.addEventListener("impress:init", function(){ // STEP CLASSES steps.forEach(function (step) { step.classList.add("future"); }); - root.addEventListener("impress-step-enter", function (event) { + root.addEventListener("impress:stepenter", function (event) { event.target.classList.remove("past"); event.target.classList.remove("future"); event.target.classList.add("present"); }, false); - root.addEventListener("impress-step-leave", function (event) { + root.addEventListener("impress:stepleave", function (event) { event.target.classList.remove("present"); event.target.classList.add("past"); }, false); }, false); - root.addEventListener("impress-init", function(){ + root.addEventListener("impress:init", function(){ // HASH CHANGE var lastHash = ""; @@ -492,7 +492,7 @@ // and it has to be set after animation finishes, because in Chrome it // causes transtion being laggy // BUG: http://code.google.com/p/chromium/issues/detail?id=62820 - root.addEventListener("impress-step-enter", function (event) { + root.addEventListener("impress:stepenter", function (event) { window.location.hash = lastHash = "#/" + event.target.id; }, false); @@ -541,7 +541,7 @@ }; }; - document.addEventListener("impress-init", function (event) { + document.addEventListener("impress:init", function (event) { var api = event.detail.api; // keyboard navigation handlers |