Home › Forums › Front-end Issues › event mouseover/mouseout img repeater ACF › Reply To: event mouseover/mouseout img repeater ACF
I’m Trying this :
<?php if( have_rows('projets') ): ?>
<?php while( have_rows('projets') ): the_row();
$image = wp_get_attachment_image_src(get_sub_field('image_projet'));
$imageHover = wp_get_attachment_image_src(get_sub_field('image_hover_projet'));
?>
<div class="col-xl-3 col-lg-3 col-md-6 col-sm-6 cas justify-content-center">
<a href="<?php the_sub_field('lien_vers_le_projet'); ?>" class="d-block w-100 a">
<?php if( get_sub_field('image_projet') ): ?>
<img class="imageProjet" src="<?php echo $image[0]; ?>"
onmouseover="this.src='<?php echo $imageHover[0]; ?>'"
onmouseout="this.src='<?php echo $image[0]; ?>'" />
<?php endif; ?>
</a>
<div class="titreProjet" data-aos-duration="900" data-aos-once="true">
<?php the_sub_field('titre_du_projet');;?>
</div>
<div data-aos-delay="300" data-aos-duration="700" data-aos-easing="ease-in-out"
data-aos-once="true" class="trait">
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
the hover on the first image works very well and when I move the mouse over it, the new image appears more disappears when I remove the mouse.
By cons I can not recover the url of the hover image on the following images ……
someone to help me, i am a little lost.
thank you
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.