jQuery:position()和offestParent()之间的差异
position()和offestParent()之间有什么区别?我尝试在单击事件中执行以下操作: console.info($(this).position(), $(this).offestParent()); console.info($(this.position(),$(this.offestParent());jQuery:position()和offestParent()之间的差异,jquery,Jquery,position()和offestParent()之间有什么区别?我尝试在单击事件中执行以下操作: console.info($(this).position(), $(this).offestParent()); console.info($(this.position(),$(this.offestParent()); 两者返回相同的值。我混淆了offestParent()和position()函数。这实际上取决于您在哪里使用代码。 position()方法允许我们检索元素相对于偏移父元素的
两者返回相同的值。我混淆了offestParent()和position()函数。这实际上取决于您在哪里使用代码。
2.你有没有试着查过他们两个?见鬼!??相同值的
是什么意思??offsetParent()
不可能返回与position()
相同的值。第一个返回一个元素,第二个返回一个带有值的对象