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. General Discussion
  3. Start gif/video mouse hover in project thumbnail

Start gif/video mouse hover in project thumbnail

Scheduled Pinned Locked Moved General Discussion
13 Posts 3 Posters 458 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.
  • A arminunruh
    Jun 15, 2023, 10:34 AM

    go to lay options

    there is a setting for project thumbnail videos

    then in customize -> project thumbnails

    there are settings for playing a video on mouseover
    try that

    D Offline
    D Offline
    davidjascha
    wrote on Jun 27, 2024, 1:26 AM last edited by davidjascha Jun 26, 2024, 9:30 PM
    #4

    @arminunruh Is there an option to have the video thumbnails return to the first frame when the cursor leaves the video area? Even better would be the option to always show the image thumbnail until you move the cursor above the image which activates the video thumbnail. Do you think you can add this functionality? Thank you!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arminunruh
      Global Moderator
      wrote on Jul 1, 2024, 5:01 PM last edited by arminunruh Jul 9, 2024, 5:31 AM
      #5

      you want an image present as your thumbnail. when you mouseover, the image gets hidden and a video is shown.

      enable videos for thumbnails and mouseover image for thumbnails in "lay options".
      in the customizer in project thumbnail mouseover, enable video playing on mouseover

      then use this css

      /* show mouseover image at first */
      .thumb.has-mouseover-img video+img.mo_thumb{
      opacity: 1!important;
      }
      body.thumb-mo-image-has-transition .thumb.has-mouseover-img video+img.mo_thumb{
      opacity: 1!important;
      }
      /* hide mouseoverimage on hover, so video behind it shows up */
      .thumb.has-mouseover-img:hover video+img.mo_thumb{
      opacity: 0!important;
      }
      body.no-touchdevice.thumb-mo-image-has-transition .thumb.has-mouseover-img:hover .ph video+img.mo_thumb{
      opacity: 0!important;
      }
      

      we use the + selector to only do all of this for thumbnails that contain a video, and have the other thumbnails work as before:
      https://www.w3schools.com/cssref/sel_element_pluss.php#:~:text=The element%2Belement selector is,directly after another specific element .

      edit for clarification: when you add a video thumbnail, also add a mouseover image thumbnail when editing your project to make this work!

      1 Reply Last reply
      0
      • A Offline
        A Offline
        arminunruh
        Global Moderator
        wrote on Jul 1, 2024, 5:19 PM last edited by
        #6

        the video can be set to currentTime 0 on mouseover to make it start from the beginning
        https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime

        video.currentTime = 0;

        using javascript/jquery and a mouseenter event you could do this, maybe this works, in "custom head" in lay options → custom css & html:

        <script>
        jQuery(document).on("mouseenter", ".thumb", function(event) {
        	var $video = jQuery(event.currentTarget).find('video');
        	if( $video.length > 0 ) {
        	    $video[0].currentTime = 0;
        	}
        });
        </script>
        

        https://laytheme.com/documentation/custom-javascript.html#binding-click-events

        1 Reply Last reply
        0
        • D Offline
          D Offline
          davidjascha
          wrote on Jul 4, 2024, 4:19 PM last edited by arminunruh Jul 10, 2024, 5:32 AM
          #7

          @arminunruh

          thank you for your answer! There is just one thing I'm missing and I think I didn't explain it well.

          What I'm looking for is:

          1. There is just the photo thumbnail.
          2. Mouse hover -> video thumbnail starts to play
          3. Mouse hover off (I mean that I move the cursor away from the thumb) -> photo thumbnail will be seen again.
          4. Again mouse hover -> video thumbnails starts to play again, but again from the start.

          I think your method almost works. Do I understand it right that it reverses the function of the mouse hover effect?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            arminunruh
            Global Moderator
            wrote on Jul 8, 2024, 9:16 AM last edited by
            #8

            what is your end goal?

            is there just a video as a thumbnail and it is paused and when you mouseover, the video plays?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              arminunruh
              Global Moderator
              wrote on Jul 8, 2024, 9:17 AM last edited by
              #9

              i understood it like this:
              you want an image present as your thumbnail. when you mouseover, the image gets hidden and a video is shown.

              D 1 Reply Last reply Jul 8, 2024, 12:47 PM
              0
              • A arminunruh
                Jul 8, 2024, 9:17 AM

                i understood it like this:
                you want an image present as your thumbnail. when you mouseover, the image gets hidden and a video is shown.

                D Offline
                D Offline
                davidjascha
                wrote on Jul 8, 2024, 12:47 PM last edited by davidjascha Jul 8, 2024, 8:49 AM
                #10

                @arminunruh

                @arminunruh said in Start gif/video mouse hover in project thumbnail:

                i understood it like this:
                you want an image present as your thumbnail. when you mouseover, the image gets hidden and a video is shown.

                This is correct + video always starts from beginning (works out with your solution) + when the mouse leaves the element again, the image is displayed again.

                I've added a video and a mouse hover image correctly, but wordpress doesn't let me remove the standard thumbnail image. maybe this is the problem? When I mousehover, I can shortyl see the mouseover image, but it doesn't display there from the beginning.

                You can see it here https://davidjascha.com/

                The thumbnail I'm talking about is the one top left.

                Thank you for your support!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  arminunruh
                  Global Moderator
                  wrote on Jul 9, 2024, 9:30 AM last edited by arminunruh Jul 9, 2024, 5:30 AM
                  #11

                  i think you forgot this:
                  go to lay options → activate mouseover image for thumbnails:

                  Screenshot 2024-07-09 at 11.28.26.png

                  now you have to actually set mouseover images for your projects where you use a video as a thumbnail.

                  inside the project:

                  Screenshot 2024-07-09 at 11.29.19.png

                  set both the video and this mouseover image

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    davidjascha
                    wrote on Jul 9, 2024, 2:17 PM last edited by davidjascha Jul 9, 2024, 10:17 AM
                    #12

                    No it works!

                    I had everything right with lay options, but there is another setting in customizing -> project thumbnails ->

                    image.png

                    Thank you!

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      arminunruh
                      Global Moderator
                      wrote on Jul 10, 2024, 9:31 AM last edited by
                      #13

                      ok very good!
                      amazing work!

                      1 Reply Last reply
                      0
                      • A arminunruh referenced this topic on Sep 20, 2024, 12:46 PM
                      • A arminunruh referenced this topic on Oct 11, 2024, 4:58 PM
                      • A arminunruh referenced this topic on Oct 11, 2024, 4:59 PM
                      • A arminunruh referenced this topic on Feb 13, 2025, 6:00 PM
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes

                      13/13

                      Jul 10, 2024, 9:31 AM


                      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
                      D
                      dmncn
                      12 minutes ago
                      C
                      craigfeldspar
                      14 minutes ago
                      S
                      Starc
                      18 minutes ago
                      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.
                      13 out of 13
                      • First post
                        13/13
                        Last post
                      0
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Search