1/* 2 * jquery.ui.potato.menu 3 * 4 * Copyright (c) 2009 makoto_kw ([email protected]) 5 * Dual licensed under the MIT and GPL licenses. 6 * 7 * Version: 1.0 8 */ 9(function($) { 10 $.fn.extend({ 11 ptMenu:function(arg) { 12 var defaltOption = { 13 vertical:false, 14 menuItemSelector: 'li', 15 menuGroupSelector: 'ul', 16 firstClass:'potato-menu', 17 menuItemClass:'potato-menu-item', 18 menuGroupClass:'potato-menu-group', 19 verticalClass:'potato-menu-vertical', 20 holizontalClass:'potato-menu-holizontal', 21 hasVerticalClass:'potato-menu-has-vertical', 22 hasHolizontalClass:'potato-menu-has-holizontal', 23 showDuration: 350, 24 hideDuration: 100 25 } 26 27 var option = (typeof(arg)!='string') ? $.extend(defaltOption,arg) : $.extend(defaltOption,{}); 28 var $menu = $(this).addClass(option.firstClass).addClass((option.vertical) ? option.verticalClass : option.holizontalClass); 29 var $menuItems = $menu.find(option.menuItemSelector).addClass(option.menuItemClass); 30 var $menuGroups = $menu.find(option.menuGroupSelector).addClass(option.menuGroupClass); 31 $menuGroups.parent().each(function(index){ 32 var bottom = $(this).parent(option.menuGroupSelector+'.'+option.firstClass).length == 1 && !option.vertical; 33 var $menuGroup = $(this).addClass((bottom) ? option.hasVerticalClass : option.hasHolizontalClass) 34 .children(option.menuGroupSelector+':first').addClass(option.verticalClass) 35 $(this) 36 .hover( 37 function(e) { 38 var offset = (bottom) ? {left:'0',top:''} : {left:$(this).width()+'px',top:'0'}; 39 $menuGroup.css({left:offset.left,top:offset.top}).fadeIn(option.showDuration); 40 }, 41 function(e) { 42 $menuGroup.fadeOut(option.hideDuration); 43 } 44 ) 45 ; 46 }); 47 $menu.find('a[href^="#"]').click(function() { 48 $menuGroups.fadeOut(option.hideDuration); 49 return ($(this).attr('href')=='#') ? false : true; 50 }) 51 ; 52 return this; 53 } 54 }) 55})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.