aboutsummaryrefslogtreecommitdiff
path: root/.themes/classic
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2013-04-04 10:22:48 -0500
committerBrandon Mathis <brandon@imathis.com>2013-04-04 10:22:48 -0500
commit49a27c929d646973ce1f4ed4c93506a10be61b81 (patch)
tree1467894160d09abaefa72f1bfa5a8693d74d0e3e /.themes/classic
parent75cc24c8d602d509e6b272db983489090595f001 (diff)
downloadmy_new_personal_website-49a27c929d646973ce1f4ed4c93506a10be61b81.tar.xz
my_new_personal_website-49a27c929d646973ce1f4ed4c93506a10be61b81.zip
fixed mobile navigation
Diffstat (limited to '')
-rw-r--r--.themes/classic/source/javascripts/octopress.js20
1 files changed, 9 insertions, 11 deletions
diff --git a/.themes/classic/source/javascripts/octopress.js b/.themes/classic/source/javascripts/octopress.js
index c3f59156..235b5d10 100644
--- a/.themes/classic/source/javascripts/octopress.js
+++ b/.themes/classic/source/javascripts/octopress.js
@@ -1,17 +1,15 @@
function getNav() {
- var mobileNav = $('nav[role=navigation] fieldset[role=search]').after('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>');
- mobileNav.children('select').append('<option value="">Navigate&hellip;</option>');
- $('ul[role=main-navigation]').addClass('main-navigation');
- $('ul.main-navigation a').each(function(i, link) {
- mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>');
- });
- $('ul.subscription a').each(function(i, link) {
- mobileNav.children('select').append('<option value="'+link.href+'">&raquo; '+link.text+'</option>');
- });
- mobileNav.children('select').bind('change', function(event) {
+ var mainNav = $('ul.main-navigation, ul[role=main-navigation]').before('<fieldset class="mobile-nav">')
+ var mobileNav = $('fieldset.mobile-nav').append('<select>');
+ mobileNav.find('select').append('<option value="">Navigate&hellip;</option>');
+ var addOption = function(i, option) {
+ mobileNav.find('select').append('<option value="' + this.href + '">&raquo; ' + $(this).text() + '</option>');
+ }
+ mainNav.find('a').each(addOption);
+ $('ul.subscription a').each(addOption);
+ mobileNav.find('select').bind('change', function(event) {
if (event.target.value) { window.location.href = event.target.value; }
});
- mobileNav.children('select').val('');
}
function addSidebarToggler() {