# Hover interactions with CMS database

**URL:** <https://forum.wixstudio.com/t/hover-interactions-with-cms-database/54280>\
**Category:** Ask the community\
**Tags:** wix-studio, design, cms, question\
**Created:** [December 2, 2023, 3:09am UTC](https://forum.wixstudio.com/t/hover-interactions-with-cms-database/54280 "2023-12-02T03:09:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Young](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/steven_young/32/85412_2.png) [@Steven\_Young](https://forum.wixstudio.com/u/Steven_Young)\
**Post date:** [December 2, 2023, 3:09am UTC](https://forum.wixstudio.com/t/hover-interactions-with-cms-database/54280/1 "2023-12-02T03:09:14Z")

</div>

**Can I have an Image change depending on which Text element is hovered over, while linked to CMS?**

**Product:** Wix Studio

I have list repeater (centre) that contains text elements linked to a database, I’d like to be able to hover over those, and have the image on the right change, and the description on the left change accordingly with which ever option I hover over. (see image attached below)

 ![Screen Shot 2023-12-02 at 2.01.21 pm](https://us1.discourse-cdn.com/wix/original/3X/1/a/1a8e41bcce5eaed90c93686644ace8272c567f7c.jpeg)

I know I can have a stack of Images piled on top of each other and use the hover interaction to make them appear one by one. But was hoping I could achieve this while just having the one image, that changes depending on the text element hovered over.

Is this possible without coding?

---

<div class="post-metadata">

**Author:** ![valentin\_wackermedia](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/valentin_wackermedia/32/81083_2.png) [@valentin\_wackermedia](https://forum.wixstudio.com/u/valentin_wackermedia)\
**Post date:** [December 2, 2023, 4:39pm UTC](https://forum.wixstudio.com/t/hover-interactions-with-cms-database/54280/2 "2023-12-02T16:39:18Z")

</div>

Hi Steven

No this is not possible without Coding (Wix Velo).

Here is the code for it:

```javascript
import wixData from 'wix-data';

$w.onReady(function () {
    // Attach a hover event to each item in the repeater
    $w('#yourRepeater').forEachItem(($item, itemData, index) => {
        $item('#yourTextElement').onMouseIn(() => {
            changeContentBasedOnHover(itemData._id);
        });
    });
});

function changeContentBasedOnHover(itemId) {
    // Query the database for the item with the given ID
    wixData.query('YourDatabase')
        .eq('_id', itemId)
        .find()
        .then(results => {
            if (results.items.length > 0) {
                const item = results.items[0];
                // Update the image and text based on the database results
                $w('#yourImageElement').src = item.imageUrl;
                $w('#yourDescriptionElement').text = item.description;
            }
        })
        .catch(err => {
            console.log('Error:', err);
        });
}

```

You can change the placeholders accordingly 🙂

Hope that answers it
