我试图使用javascript scrollheight和jQuery scrollTop(),但没有得到任何结果

我试图使用javascript scrollheight和jQuery scrollTop(),但没有得到任何结果,javascript,jquery,scrollbar,scrolltop,console.log,Javascript,Jquery,Scrollbar,Scrolltop,Console.log,这是我在控制台中使用的代码 var h = jQuery(this).scrollHeight; console.log(h); 这在控制台中显示为未定义 jQuery("#activeslide3 p").scroll(function(){ var pos = jQuery(this).scrollTop(); console.log(pos); }); 这不会在scroll上提供任何输出。jQuerythis提供对没有scrollHeight属性的窗口的引用

这是我在控制台中使用的代码

var h = jQuery(this).scrollHeight; 


console.log(h); 
这在控制台中显示为未定义

jQuery("#activeslide3 p").scroll(function(){    
var pos = jQuery(this).scrollTop();    
console.log(pos);
});  

这不会在scroll上提供任何输出。

jQuerythis提供对没有scrollHeight属性的窗口的引用,因此提供undefined。在scrolltop中提供一个值。类似于jQuerythis.ScrollTop300的内容是您想要的吗?