0
我需要将current_src
的值传递给mouseleave函数。jQuery - 无法获取悬停函数内部的变量(mouseleave)
console.log返回undefined
。
var current_src, swap_src;
jQuery(".browseProductImage").hover(
function(){
var current_src = jQuery(this).attr('src');
var swap_src = jQuery(this).next().attr('src');
jQuery(this).attr('src', swap_src);
},
function(){
jQuery(this).attr('src', current_src);
console.log(current_src)
}
);
就发现它。谢谢! – RhymeGuy
因此无论如何都要考虑接受答案...... –