diff options
author | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-10 12:20:20 +0100 |
---|---|---|
committer | Bartek Szopka <bartek.szopka+github@gmail.com> | 2012-03-10 12:20:20 +0100 |
commit | 207c823a694816daf315e1172954ab5a539457b5 (patch) | |
tree | aceb3bae7aa78398c1234f1fc7d8c4e08a6991a5 | |
parent | 047c1c25a188e72ba01f9dee0699834cd3b4201b (diff) | |
download | impress.js-207c823a694816daf315e1172954ab5a539457b5.tar.gz |
`goto` is a future reserved word, so API method is renamed to `stepTo`
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | js/impress.js | 18 |
2 files changed, 10 insertions, 10 deletions
@@ -323,7 +323,7 @@ if ("ontouchstart" in document.documentElement) { `api.next()` - moves to next step of the presentation, `api.prev()` - moves to previous step of the presentation - `api.goto( stepElement ) - moves the presentation to given step element (the DOM element of the step). + `api.stepTo( stepElement ) - moves the presentation to given step element (the DOM element of the step). You can also simply call `impress()` again to get the API, so `impress().next()` is also allowed. Don't worry, it wont initialize the presentation again. diff --git a/js/impress.js b/js/impress.js index 845304c..b647728 100644 --- a/js/impress.js +++ b/js/impress.js @@ -277,7 +277,7 @@ var windowScale = computeWindowScale(); - var goto = function ( el, force ) { + var stepTo = function ( el, force ) { if ( !isStep(el) || (el == active && !force) ) { // selected element is not defined as step or is already active return false; @@ -362,18 +362,18 @@ var prev = steps.indexOf( active ) - 1; prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ]; - return goto(prev); + return stepTo(prev); }; var next = function () { var next = steps.indexOf( active ) + 1; next = next < steps.length ? steps[ next ] : steps[ 0 ]; - return goto(next); + return stepTo(next); }; window.addEventListener("hashchange", function () { - goto( getElementFromUrl() ); + stepTo( getElementFromUrl() ); }, false); window.addEventListener("orientationchange", function () { @@ -382,10 +382,10 @@ // START // by selecting step defined in url or first step of the presentation - goto(getElementFromUrl() || steps[0]); + stepTo(getElementFromUrl() || steps[0]); return (roots[ "impress-root-" + rootId ] = { - goto: goto, + stepTo: stepTo, next: next, prev: prev }); @@ -461,7 +461,7 @@ } } - if ( impress().goto(target) ) { + if ( impress().stepTo(target) ) { event.stopImmediatePropagation(); event.preventDefault(); } @@ -476,7 +476,7 @@ target = target.parentNode; } - if ( impress().goto(target) ) { + if ( impress().stepTo(target) ) { event.preventDefault(); } }, false); @@ -503,7 +503,7 @@ // rescale presentation when window is resized window.addEventListener("resize", throttle(function (event) { // force going to active step again, to trigger rescaling - impress().goto( document.querySelector(".active"), true ); + impress().stepTo( document.querySelector(".active"), true ); }, 250), false); })(document, window); |