1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <script type="text/javascript"> $(document).ready(function () { $('li.menu-term').bind('click', function (event) { console.log('div#v' + this.id); var menuId = 'div#v' + this.id; openVmenu(menuId); //判斷群組or網頁 if ($('div#v' + this.id + ' div.vmenu-term:first')[0].className.indexOf('vmenu-toggle') != -1) { //開啟menu群組 //$('div#v' + this.id + ' div.vmenu-term:first').toggle('blind'); } else { //開啟網頁 //$(location).attr('href', $('div#v' + this.id + ' div.vmenu-term:first a:first').attr('href')); } }); function openVmenu(menuId) { $('div[id^=vmenu]').hide(); // $('div#v' + this.id).show(); $(menuId).show(); $('div.vmenu-group-open').removeClass('vmenu-group-open').addClass('vmenu-group'); $('div.vmenu').hide(); } }); </script> |
Direct link: https://paste.plurk.com/show/CyinjCTR6xg7OsNa6yas