1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-09-03 01:52:47 +02:00

Fix counter link

This commit is contained in:
Luis
2017-04-08 13:14:25 +02:00
parent ee6e0045e5
commit 78ababde67
4 changed files with 41 additions and 13 deletions

View File

@@ -48,9 +48,7 @@ export default class Navigation {
* Counter Element.
* @type {Element}
*/
this.counter = DOM.createNode('a', ELEMENT_ID.COUNTER);
this.counter.href = '#';
this.counter.title = 'View all slides';
this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER);
/**
* @type {WebSlides}
* @private
@@ -83,7 +81,7 @@ export default class Navigation {
* @param {string|number} max Max slide number.
*/
updateCounter(current, max) {
this.counter.textContent = `${current} / ${max}`;
this.counter.childNodes[0].textContent = `${current} / ${max}`;
}
/**
@@ -100,6 +98,21 @@ export default class Navigation {
return arrow;
}
/**
* Creates the navigation counter.
* @param {!String} id Desired ID for the counter.
* @return {Element} The arrow element.
*/
static createCounter(id) {
const counter = DOM.createNode('span', id);
const link = document.createElement('a');
link.href = '#';
link.title = 'View all slides';
counter.appendChild(link);
return counter;
}
/**
* Slide Change event handler. Will update the text on the navigation.
* @param {CustomEvent} event