0

このための正しいアクションを呼び出す正しい方法でビットが立ち往生しました。既存の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');
    });

どんな助けでも素晴らしいでしょう!ありがとうございました

4

1 に答える 1

0

これがページ上でアンカー タグを持つ唯一の <h2> である場合、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();
});
于 2012-05-20T05:18:33.283 に答える