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.next()` - moves to next step of the presentation,
|
||||||
`api.prev()` - moves to previous 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.
|
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.
|
Don't worry, it wont initialize the presentation again.
|
||||||
|
|||||||
@@ -277,7 +277,7 @@
|
|||||||
|
|
||||||
var windowScale = computeWindowScale();
|
var windowScale = computeWindowScale();
|
||||||
|
|
||||||
var goto = function ( el, force ) {
|
var stepTo = function ( el, force ) {
|
||||||
if ( !isStep(el) || (el == active && !force) ) {
|
if ( !isStep(el) || (el == active && !force) ) {
|
||||||
// selected element is not defined as step or is already active
|
// selected element is not defined as step or is already active
|
||||||
return false;
|
return false;
|
||||||
@@ -362,18 +362,18 @@
|
|||||||
var prev = steps.indexOf( active ) - 1;
|
var prev = steps.indexOf( active ) - 1;
|
||||||
prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ];
|
prev = prev >= 0 ? steps[ prev ] : steps[ steps.length-1 ];
|
||||||
|
|
||||||
return goto(prev);
|
return stepTo(prev);
|
||||||
};
|
};
|
||||||
|
|
||||||
var next = function () {
|
var next = function () {
|
||||||
var next = steps.indexOf( active ) + 1;
|
var next = steps.indexOf( active ) + 1;
|
||||||
next = next < steps.length ? steps[ next ] : steps[ 0 ];
|
next = next < steps.length ? steps[ next ] : steps[ 0 ];
|
||||||
|
|
||||||
return goto(next);
|
return stepTo(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("hashchange", function () {
|
window.addEventListener("hashchange", function () {
|
||||||
goto( getElementFromUrl() );
|
stepTo( getElementFromUrl() );
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
window.addEventListener("orientationchange", function () {
|
window.addEventListener("orientationchange", function () {
|
||||||
@@ -382,10 +382,10 @@
|
|||||||
|
|
||||||
// START
|
// START
|
||||||
// by selecting step defined in url or first step of the presentation
|
// 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 ] = {
|
return (roots[ "impress-root-" + rootId ] = {
|
||||||
goto: goto,
|
stepTo: stepTo,
|
||||||
next: next,
|
next: next,
|
||||||
prev: prev
|
prev: prev
|
||||||
});
|
});
|
||||||
@@ -461,7 +461,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( impress().goto(target) ) {
|
if ( impress().stepTo(target) ) {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
@@ -476,7 +476,7 @@
|
|||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( impress().goto(target) ) {
|
if ( impress().stepTo(target) ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
@@ -503,7 +503,7 @@
|
|||||||
// rescale presentation when window is resized
|
// rescale presentation when window is resized
|
||||||
window.addEventListener("resize", throttle(function (event) {
|
window.addEventListener("resize", throttle(function (event) {
|
||||||
// force going to active step again, to trigger rescaling
|
// force going to active step again, to trigger rescaling
|
||||||
impress().goto( document.querySelector(".active"), true );
|
impress().stepTo( document.querySelector(".active"), true );
|
||||||
}, 250), false);
|
}, 250), false);
|
||||||
})(document, window);
|
})(document, window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user