goto is a future reserved word, so API method is renamed to stepTo
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user