代码如下: 
(function($){ 
$.navs=function(){ 
return $('#top_menu_bar  li').each(function(){ 
$(this).hover( 
  function(){ 
  $(this).find('ul:eq(0)').show(); 
  }, 
  function(){ 
  $(this).find('ul:eq(0)').hide(); 
  } 
); 
}); 
}; 
})(jQuery); 
 
上面是直接定义属性。下面是种常见的方法: 
 代码如下: 
jQuery.extend({ 
navs:function(){ 
return $('#top_menu_bar  li').each(function(){ 
$(this).hover( 
  function(){ 
  $(this).find('ul:eq(0)').show(); 
  }, 
  function(){ 
  $(this)...[ 查看全文 ]