Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Feedback
  3. Thumbnail image hover to make a text appear

Thumbnail image hover to make a text appear

Scheduled Pinned Locked Moved Feedback
12 Posts 2 Posters 284 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    g.chng
    wrote on last edited by
    #1

    Hi everyone,

    I have a thumbnail grid on my website :

    ![1 copie.jpg](Image dimensions are too big)

    I was wondering if it was possible to hover these thumbnails images to make appear a fixed/sticky text (that would be the description) like this :

    ![2 copie.jpg](Image dimensions are too big)

    Thanks by advance

    G

    website : https://www.gabrielchesnelong.com/category/project-index/

    1 Reply Last reply
    0
    • G Offline
      G Offline
      g.chng
      wrote on last edited by
      #2

      2_.jpg

      1 Reply Last reply
      0
      • arminunruhA Offline
        arminunruhA Offline
        arminunruh
        Global Moderator
        wrote on last edited by
        #3

        yea i think you could use the project description feature
        https://laytheme.com/documentation/project-description.html

        and then use custom css to put the description there

        could be a little hard to do

        1 Reply Last reply
        0
        • G Offline
          G Offline
          g.chng
          wrote on last edited by
          #4

          Thank you for your help, I am going to try that !

          1 Reply Last reply
          0
          • G Offline
            G Offline
            g.chng
            wrote on last edited by
            #5

            @arminunruh I tried to add some js and CSS. I first wrote enabled the project description feature and then disabled the feature, my goal was to reach the project description with the js even it's disabled and make it appear when I hover it. The hover works but it doesn't make the description appear... Here are my custom CSS and JS :
            CSS :
            /* Thumbnail grid style /
            .thumbnail-grid {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            padding: 5px; /
            Adds spacing around the grid /
            margin: 0; /
            Removes default margins /
            list-style: none; /
            Removes list bullets /
            position: relative; /
            Relative position to manage z-index */
            }

            /* Thumbnail style */
            .thumbnail-wrap {
            position: relative;
            }

            /* Hover effect to display project description /
            .thumbnail-wrap:hover::before {
            content: attr(data-description); /
            Displays project description /
            position: fixed;
            top: 40px;
            left: 8px;
            padding: 10px; /
            Adds spacing around description /
            background-color: rgba(0, 0, 0, 0.5); /
            Semi-transparent background color /
            color: white; /
            Text color /
            z-index: 9999; /
            Ensures description is above any other content */
            }

            /* Footer */
            #footer-region {
            position: fixed;
            bottom: 20px;
            left: 8px;
            }

            JS :
            <script>
            // Select all project thumbnails
            const thumbnails = document.querySelectorAll('.thumbnail-wrap');

            // Iterate through each thumbnail
            thumbnails.forEach(thumbnail => {
            // Listen for hover event
            thumbnail.addEventListener('mouseenter', () => {
            // Get corresponding project description
            const description = thumbnail.querySelector('.descr');
            if (description) {
            // Add description as a data attribute for use in CSS
            thumbnail.setAttribute('data-description', description.textContent.trim());
            }
            });
            });
            </script>

            Do you have any tips to make it work ?

            Thanks by advance

            G

            Website link : https://www.gabrielchesnelong.com/

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by
              #6

              can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                g.chng
                wrote on last edited by
                #7

                Hi Armin, I sent you everything at info@laytheme.com, thank you for your help !

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  g.chng
                  wrote on last edited by
                  #8

                  @arminunruh *

                  1 Reply Last reply
                  0
                  • arminunruhA Offline
                    arminunruhA Offline
                    arminunruh
                    Global Moderator
                    wrote on last edited by arminunruh
                    #9

                    yea please wait for my answer, i was on holidays for a few days

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      g.chng
                      wrote on last edited by
                      #10

                      I didn't mean to bother you sorry, I just noticed I didn't mention your name in the first message so I didn't know if you were going to see it.
                      It's as you can, and if anything I am willing to pay as well. Thanks again for your help.

                      1 Reply Last reply
                      0
                      • arminunruhA Offline
                        arminunruhA Offline
                        arminunruh
                        Global Moderator
                        wrote on last edited by arminunruh
                        #11

                        sure! no problem!
                        this is what it looks like: https://www.dropbox.com/scl/fi/xp8caw1uo1l59cw4ma37z/Screen-Recording-2024-02-27-at-11.52.03.mov?rlkey=ddmp8xd4ggavwhjz7pelv2i3b&dl=0

                        so what i did now:

                        custom css:

                        body.no-touchdevice .my-description{
                            position: fixed;
                            top: 40px;
                            left: 8px;
                            z-index: 90;
                            width: 20%;
                        }
                        body.no-touchdevice .my-description a{
                            color: black;
                        }
                        body.no-touchdevice .thumbnail-wrap .lay-textformat-parent>*:not(.thumb){
                            display: none;
                        }
                        

                        custom head content:

                        <script>
                            jQuery(document).on('mouseenter', '.thumbnail-wrap', function(){
                                if( jQuery("body").hasClass("no-touchdevice") ) {
                                    // var $text = jQuery(this).find('.lay-textformat-parent>*:not(a.thumb)').clone();
                                    var $text = jQuery(this).find('.lay-textformat-parent>*').clone();
                                    jQuery('.my-description').html($text)
                                }
                            });
                            window.laytheme.on("transition_out", function(){
                                jQuery('.my-description').html('')
                            })
                        </script>
                        

                        custom html at bottom:

                        <div class="my-description">
                        </div>
                        

                        Then i enabled "project descriptions" in "lay options"
                        and actually entered a project description for a project, just for the upper left one.

                        if all of your projects have a description, you can un-comment this line:
                        // var $text = jQuery(this).find('.lay-textformat-parent>*:not(a.thumb)').clone();

                        and then make this line a comment by prepending //:

                        var $text = jQuery(this).find('.lay-textformat-parent>*').clone();

                        then only the descriptions will be used, not the project titles too

                        i see you want more work done on this as you asked for in your email address.
                        if you want to pay me 100€ per hour i can work more on this

                        but i do believe this should be sufficient and maybe you can find a solution for your other custom code for your time

                        also please read this:
                        https://laytheme.com/documentation/custom-javascript.html

                        and this:
                        https://laytheme.com/documentation/custom-css-styling.html

                        it might help you with general understanding

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          g.chng
                          wrote on last edited by
                          #12

                          Thank you so much for this. I am going to try to make it work by myself and if I need more help on the website I will keep you up to work with you.
                          Thank you again for that, it helps a lot !
                          Have a good evening !

                          1 Reply Last reply
                          1
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          I also code custom websites or custom Lay features.
                          šŸ’æ Email me here: šŸ’æ
                          info@laytheme.com

                          Before you post:
                          1. When using a WordPress Cache plugin, disable it or clear your cache.
                          2. Update Lay Theme and all Lay Theme Addons
                          3. Disable all Plugins
                          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                          This often solves issues you might run into

                          When you post:
                          1. Post a link to where the problem is
                          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                          Online Users
                          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                          laytheme.com
                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Search