Skip to content

Commit

Permalink
Minor improvemets on list navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Jan 4, 2019
1 parent d82e020 commit a6242b6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/nav.js
Expand Up @@ -19,6 +19,14 @@ class Nav {
return this._getLists().length - 1;
}

_clickClass(x) {
document.querySelector(`.${x}`).click();
}

_clickId(x) {
document.getElementById(x).click();
}

_currentIdx() {
let currentIdx = 0;
const lists = this._getLists();
Expand Down Expand Up @@ -78,7 +86,8 @@ class Nav {
if (idx >= 0 && idx <= this._lastIdx) {
const lists = this._getLists();
const {id, className} = lists[idx];
this.click(id ? `#${id}` : `.${className}`);
console.log({id, className});
return id ? this._clickId(id) : this._clickClass(className);
}
}

Expand Down

0 comments on commit a6242b6

Please sign in to comment.