咬住正确的方式为此调用正确的操作。 现有的script.js在鼠标悬停时淡化范围颜色,但我还希望它显示关联的缩略图文本和鼠标悬停链接
来自WP的代码显示缩略图标题&链路
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
和现有的脚本文件
$('.thumb img').after('<span></span>');
$('.thumb span').css('opacity','0');
$('.post_home a:first-child').hover(function(){
$(this).find('span').stop().animate({opacity: 0.95}, 200);
$(this).nextAll().find('a').css('color', '#ff0000');
}, function(){
$(this).find('span').stop().animate({opacity: 0}, 200);
$(this).nextAll().find('a').removeAttr('style');
});
任何帮助都是TERRIFIC! 谢谢
答案 0 :(得分:0)
如果这是唯一的&lt; h2&gt;在页面上有一个锚标记,然后我会将jquery hide()和show()方法添加到脚本中:
$('.thumb img').after('<span></span>');
$('.thumb span').css('opacity','0');
$('.post_home a:first-child').hover(function(){
$(this).find('span').stop().animate({opacity: 0.95}, 200);
$(this).nextAll().find('a').css('color', '#ff0000');
$('h2 a').show();
}, function(){
$(this).find('span').stop().animate({opacity: 0}, 200);
$(this).nextAll().find('a').removeAttr('style');
$('h2 a').hide();
});