上下文说明(WordPress):我想检查我的 li 元素是否有一个名为“current-menu-item”的类,如果它确实希望它停止动画功能。如果它没有那个类继续动画。此脚本当前不工作。谢谢你的帮助。
$(document).ready(function ()
{
$('.nav li a').hover(function()
{
if ($(this).parentNode.hasClass('current-menu-item'))
{
alert('this item has the class of current-menu-item');
}
else
{
$(this).animate({color:'#3b3b3b'}, 300, 'linear');
}
},
function()
{
if ($(this).parentNode.hasClass('current-menu-item'))
{
// do nothing
}
else
{
$(this).animate({color:'#999'}, 300, 'linear');
}
});
});