summaryrefslogtreecommitdiffstats
path: root/source/javascripts/navigation.js
diff options
context:
space:
mode:
authorSkyArrow <tommy351@gmail.com>2012-01-24 18:23:47 +0100
committerSkyArrow <tommy351@gmail.com>2012-01-24 18:23:47 +0100
commit7c05b0a627b22f227084d5144e9eb0879c920a68 (patch)
tree73491895f8a94d437332e7a1a8026b2eca0f2c08 /source/javascripts/navigation.js
parenta63d03908153e5d0f2825d5972d726e92f2ad92c (diff)
downloadoctopress-theme-jeyzu-7c05b0a627b22f227084d5144e9eb0879c920a68.zip
octopress-theme-jeyzu-7c05b0a627b22f227084d5144e9eb0879c920a68.tar.gz
<select> menu for mobile devices
Diffstat (limited to 'source/javascripts/navigation.js')
-rw-r--r--source/javascripts/navigation.js16
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