Support

Account

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