1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-21 12:21:46 +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. * Counter Element.
* @type {Element} * @type {Element}
*/ */
this.counter = DOM.createNode('a', ELEMENT_ID.COUNTER); this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER);
this.counter.href = '#';
this.counter.title = 'View all slides';
/** /**
* @type {WebSlides} * @type {WebSlides}
* @private * @private
@@ -83,7 +81,7 @@ export default class Navigation {
* @param {string|number} max Max slide number. * @param {string|number} max Max slide number.
*/ */
updateCounter(current, max) { 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; 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. * Slide Change event handler. Will update the text on the navigation.
* @param {CustomEvent} event * @param {CustomEvent} event

View File

@@ -316,6 +316,7 @@ html.ws-ready body {
#webslides { #webslides {
height: 100vh; height: 100vh;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }
/* -- Hide scrollbar, but still being able to scroll -- */ /* -- Hide scrollbar, but still being able to scroll -- */
@@ -1547,7 +1548,7 @@ opacity: 1;
} }
*/ */
#navigation #counter { #counter {
position: relative; position: relative;
display: block; display: block;
width: 10rem; width: 10rem;
@@ -1555,15 +1556,13 @@ opacity: 1;
margin-left: auto; margin-left: auto;
text-align: center; text-align: center;
line-height: 4.8rem; line-height: 4.8rem;
height: auto;
padding: 0;
} }
#navigation p { #navigation p {
margin-bottom: 0; margin-bottom: 0;
} }
#navigation a { a#next,a#previous {
position: absolute; position: absolute;
width: 4rem; width: 4rem;
height: 4rem; height: 4rem;

View File

@@ -1661,9 +1661,7 @@ var Navigation = function () {
* Counter Element. * Counter Element.
* @type {Element} * @type {Element}
*/ */
this.counter = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].createNode('a', ELEMENT_ID.COUNTER); this.counter = Navigation.createCounter(ELEMENT_ID.COUNTER);
this.counter.href = '#';
this.counter.title = 'View all slides';
/** /**
* @type {WebSlides} * @type {WebSlides}
* @private * @private
@@ -1702,7 +1700,7 @@ var Navigation = function () {
}, { }, {
key: 'updateCounter', key: 'updateCounter',
value: function updateCounter(current, max) { value: function updateCounter(current, max) {
this.counter.textContent = current + ' / ' + max; this.counter.childNodes[0].textContent = current + ' / ' + max;
} }
/** /**
@@ -1752,6 +1750,24 @@ var Navigation = function () {
return arrow; return arrow;
} }
/**
* Creates the navigation counter.
* @param {!String} id Desired ID for the counter.
* @return {Element} The arrow element.
*/
}, {
key: 'createCounter',
value: function createCounter(id) {
var counter = __WEBPACK_IMPORTED_MODULE_0__utils_dom__["a" /* default */].createNode('span', id);
var link = document.createElement('a');
link.href = '#';
link.title = 'View all slides';
counter.appendChild(link);
return counter;
}
}]); }]);
return Navigation; return Navigation;

File diff suppressed because one or more lines are too long