$.fn.sample = function()
呼び出し元があります。たとえば$('#example').sample();
、関数内で「this」をスコープに使用できます。
$.fn.sample = function(){
console.log($(this).width());
} //In this case, it would log the width of #example
しかし、次のように、ホバー関数を別の要素に呼び出すとしましょう
$.fn.sample = function(){
console.log($(this).width());
$('#other').hover(function(){
//Here, $(this) will refer to #other
});
}
したがって、ホバー関数内で「$(this)」は #other を参照します。「親」の $(this) を使用する方法はありますか? この場合、このホバー関数内の「#example」は?