通过jQuery检测鼠标事件实现不同的效果,
hover 可以执行两个操作,第一个函数是鼠标移入事件,第二个函数是鼠标移出事件,$(this)表示当前检测到的标签,可以对其进行添加class,或者设置css样式等操作
$('.card').hover(function () {
$(this).addClass('shadow')
$(this).find('a').css('color', '#FE4F70')
$(this).find('a').css('transition', 'all .2s ease-in-out')
},
function () {
$(this).removeClass('shadow')
$(this).find('a').css('color', '#203656')
$(this).find('a').css('transition', 'all .2s ease-in-out')
}
)