diff options
author | SkyArrow <tommy351@gmail.com> | 2012-01-24 18:23:47 +0100 |
---|---|---|
committer | SkyArrow <tommy351@gmail.com> | 2012-01-24 18:23:47 +0100 |
commit | 7c05b0a627b22f227084d5144e9eb0879c920a68 (patch) | |
tree | 73491895f8a94d437332e7a1a8026b2eca0f2c08 /source/javascripts | |
parent | a63d03908153e5d0f2825d5972d726e92f2ad92c (diff) | |
download | octopress-theme-jeyzu-7c05b0a627b22f227084d5144e9eb0879c920a68.zip octopress-theme-jeyzu-7c05b0a627b22f227084d5144e9eb0879c920a68.tar.gz |
<select> menu for mobile devices
Diffstat (limited to 'source/javascripts')
-rw-r--r-- | source/javascripts/navigation.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/javascripts/navigation.js b/source/javascripts/navigation.js new file mode 100644 index 0000000..546edf1 --- /dev/null +++ b/source/javascripts/navigation.js @@ -0,0 +1,16 @@ +(function($){ + var appends = '<option>選單</option>'; + + $('.menu .main > li').each(function(){ + var link = $(this).children('a'); + appends += '<option value="'+link.attr('href')+'">'+link.html()+'</option>'; + $(this).find('li').each(function(){ + var link = $(this).children('a'); + appends += '<option value="'+link.attr('href')+'">- '+link.html()+'</option>'; + }); + }); + + $('nav.menu').append('<select>'+appends+'</select>').on('change', 'select', function(){ + location.href = $(this).val(); + }); +})(jQuery);
\ No newline at end of file |