summaryrefslogtreecommitdiffstats
path: root/source/javascripts/navigation.js
diff options
context:
space:
mode:
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