Fade In/out background featured image when mouseover the title link.
-
Hi, I’m a newbie to WordPress, and I’d appreciate in advance for any guides.
I’m trying to build a functionality for my portfolio where when I hover over a link, featured images display as background images that fades in and out like this website: https://dennisadelmann.deThis is as far as I got:
<?php /** * Front Page Template * * Lists project titles with featured images * * @package WordPress */ get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <section class="column-left"> <div class="site-info"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> <h1 class="site-title"><?php bloginfo( 'name' ); ?><span class="site-subtitle"> <?php bloginfo('description'); ?></span></h1> </a> </div> <article class="bio"> <p class="bio-description"> <?php the_content() ?> </p> </article> <article class="project-list"> <ul class="project-title slideInUp"> <?php $args = array( 'post_type' => 'project', ); $postProject = new WP_Query( $args ); // The Loop while ( $postProject->have_posts() ) : $postProject->the_post(); ?> <li class="slideInUp"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; // Reset Post Data wp_reset_postdata(); ?> </ul> </article> <!-- .project-list --> </section> <aside class="column-right"> <?php $args = array( 'post_type' => 'project', ); $postProject = new WP_Query( $args ); // The Loop while ( $postProject->have_posts() ) : $postProject->the_post(); ?> <?php if ( has_post_thumbnail() ) : ?> <?php $post_thumbnail_id = get_post_thumbnail_id( $post->ID ); if ( $post_thumbnail_id ) : ?> <?php $post_thumbnail_medium = wp_get_attachment_image_src($post_thumbnail_id, 'medium'); $post_thumbnail_large = wp_get_attachment_image_src($post_thumbnail_id, 'large'); $post_thumbnail_large_2x = wp_get_attachment_image_src($post_thumbnail_id, 'large_2x'); ?> <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' ); $url = $thumb['0']; ?> <div class="post-thumbnail image-container animated fadeIn" style="background-image:url(<?=$url?>);"></div> <?php endif ?> <?php endif; ?> <?php endwhile; // Reset Post Data wp_reset_postdata(); ?> </aside> </main><!-- .site-main --> </div><!-- .content-area --> <?php get_footer(); ?>
Here is the dev link: https://www.suakang.net/dev/
Please let me know if I’m missing any information to resolve this.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Fade In/out background featured image when mouseover the title link.’ is closed to new replies.