$(".column a").mouseenter(function() {
var color_column=$(this).closest('.column').children('.coloured-strip').css('color');
$(this).siblings('p').animate({color:color_column},2000);
$(this).animate({color:color_column},2000);
});
有什么方法可以将两个动画函数合并为一个,因为它们是相同的?
谢谢 卢卡
最佳答案
当然,只需使用 .add()
:
$(this).siblings('p').add(this).animate({color:color_column},2000);
关于javascript - jquery 在相对于 'This' 的多个元素上运行相同的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7370303/