0
我在使用jQuery的懸停功能和Wordpress循環時遇到了問題。每次我懸停一張圖片(有6張)時,它們都會褪色,而不僅僅是單張圖片。請幫忙。jQuery在Wordpress中懸停:在淡出「默認」div時淡入暗處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>
謝謝你們。
非常感謝。現在只有一個被選中,但淡入和淡出效果不起作用,有什麼建議? – Mauricio
難道是因爲你的'hover'回調函數是相同的,而不是相互的? – Blazemonger
我也這麼認爲,但我改變了它(上面編輯),什麼也沒有發生。 – Mauricio