jQuery选择“外部类”;这";
好的,这是我的安排 HTML: 这是可行的,但由于我将使用相同的代码和类处理多个元素,所以它会影响所有元素,而不是每个元素jQuery选择“外部类”;这";,jquery,class,select,jquery-animate,Jquery,Class,Select,Jquery Animate,好的,这是我的安排 HTML: 这是可行的,但由于我将使用相同的代码和类处理多个元素,所以它会影响所有元素,而不是每个元素 我不熟悉js和jquery,因此我建议您将悬停限制为当前块,首先使用最接近()找到父锚定标记,然后使用class视频图像移动到anhor的兄弟 jQuery(".video-play-button").hover( function () { jQuery(this).closest('a').next(".video-image").stop().
我不熟悉js和jquery,因此我建议您将
悬停限制为当前块,首先使用最接近()找到父锚定标记,然后使用class视频图像移动到anhor的兄弟
jQuery(".video-play-button").hover(
function () {
jQuery(this).closest('a').next(".video-image").stop().animate({opacity: '0.7'}, 300);},
function () {
jQuery(this).closest('a').next(".video-image").stop().animate({opacity: '1'}, 400);
});
除了答案,这也应该有效:
jQuery(".video-play-button").parent().hover(
function () {
jQuery(this).next().stop().animate({opacity: '0.7'}, 300);},
function () {
jQuery(this).next().stop().animate({opacity: '1'}, 400);
});
你能在jsFiddle.net上做一个演示吗?不用担心,我发现了一个简单的打字错误,修复后解决了这个问题,谢谢!
jQuery(".video-play-button").hover(
function () {
jQuery(this).closest('a').next(".video-image").stop().animate({opacity: '0.7'}, 300);},
function () {
jQuery(this).closest('a').next(".video-image").stop().animate({opacity: '1'}, 400);
});
jQuery(".video-play-button").parent().hover(
function () {
jQuery(this).next().stop().animate({opacity: '0.7'}, 300);},
function () {
jQuery(this).next().stop().animate({opacity: '1'}, 400);
});