写过这样一段jq

 

$('ul li.navbox').hover(function(){
         $('div',$(this)).fadeIn('fast'); //   先忽略掉‘div’看,$($(this))也是jq对象                           
    },function(){
         $('div',$(this)).fadeOut('fast');    
    });
对比看这样写效果是一样的
$('ul li.navbox').hover(function(){
         $('div',this).fadeIn('fast');     //看上去有点儿别扭吧,先忽略掉‘div’,不就是常见的$(this)jq当前对象                          
    },function(){
         $('div',this).fadeOut('fast');    
    });

 总结this是js对象,而这里面都是jq对象,他们是$($(this)),和$(this)

 

 

 

 单独分析下:

 a = this;     //a是JS对象
 b = $(this);  //b是JQ对象
 $(a)  和  $(b)  ,现在加上了$(),所以他们都是JQ对象了

 

 

相关文章:

  • 2021-06-13
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
相关资源
相似解决方案