Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #12 from Financial-Times/fixes
Browse files Browse the repository at this point in the history
Fixes in more button
  • Loading branch information
Alberto Elias committed Jul 10, 2014
2 parents 391624c + f948987 commit c0a08d2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Responsive hierarchical nav.

## Browser Support

Tested and working on:

* Chrome
* Firefox

Tested and needs fixing:

* IE: responsive doesn't work. Needs fix in [o-squishy-list](https://github.com/Financial-Times/o-squishy-list)

## Navigation

All Navigation options have the same general markup structure that you can see in [main.mustache](https://github.com/Financial-Times/o-hierarchical-nav/blob/master/main.mustache)
Expand Down
18 changes: 15 additions & 3 deletions src/js/ResponsiveNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,30 @@ function ResponsiveNav(rootEl) {
function addItemToMoreList(text, href, ul) {
var itemEl = document.createElement('li'),
aEl = document.createElement('a');
aEl.innerText = text;

window.hiya = aEl;
if (typeof aEl.textContent !== 'undefined') {
console.log('hi');
aEl.textContent = text;
console.log(aEl);
} else {
aEl.innerText = text;
}
aEl.href = href;
itemEl.appendChild(aEl);
moreListEl.appendChild(itemEl);
}

function populateMoreList(hiddenEls) {
emptyMoreList();
if (!isMegaDropdownControl(moreEl)) {
emptyMoreList();
}
for (var c = 0, l = hiddenEls.length; c < l; c++) {
var aEl = hiddenEls[c].querySelector('a');
var ulEl = hiddenEls[c].querySelector('ul');
addItemToMoreList(aEl.innerText, aEl.href, ulEl);

var aText = (typeof aEl.textContent !== 'undefined') ? aEl.textContent : aEl.innerText;
addItemToMoreList(aText, aEl.href, ulEl);
}
}

Expand Down

0 comments on commit c0a08d2

Please sign in to comment.