2011-11-09 12 views
0

WordpressのループでjQueryのホバー機能を使用する際に問題があります。私が1つのイメージ(6つがある)を動かすたびに、彼らはすべて単一のイメージの代わりにすべて消えます。助けてください。WordpressのjQueryのホバー: "デフォルトの"ものをフェードアウトしている間に隠れたdivにフェードします

は、ここに私のコードです:

<?php query_posts('showposts=6&cat=-4'); ?> 
<?php if (have_posts()) : ?> 
<?php while (have_posts()) : the_post(); if ($post->ID == $do_not_duplicate) continue; update_post_caches($posts); ?> 

<li class="show1"> 

<?php $thumb = get_post_meta($post->ID, 'thumb', true); ?> 

<a href="#" title="Permanent Link to <?php the_title_attribute(); ?>" class="show"><?php echo$thumb; ?></a> 

<div class="hide"> 

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> 

    <?php the_excerpt(); ?> 

    <a class="view_project" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">View Project »</a> 
</div> 
</li> 

と私はjavascript

<script type="text/javascript"> 
$(function() { 
$('li.show1').children('.hide').hide(); 

$('li.show1').hover(function() { 
    $(this).children('a.show').fadeOut('slow') 
     .end().children('.hide').fadeIn('slow'); 
}, function() { 
    $(this).children('a.show').fadeIn('slow') 
     .end().children('.hide').fadeOut('slow'); 
}); 
}); 
</script> 

みんなありがとうです。

答えて

0

$('a.show')$(this).children('a.show')に置き換えてください。これにより、fadeOutがホバーオーバーされたli内のアンカーリンクに限定されます。

+0

ありがとう、たくさんの男。今では1つだけが選択されていますが、fadeInとfadeOutのエフェクトは機能していません。 – Mauricio

+0

'hover'コールバック関数の両方が相反するのではなく、同じである可能性がありますか? – Blazemonger

+0

私もそうだと思っていましたが、私はそれを変更しました(上の編集)何も起こっていません。 – Mauricio

関連する問題