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. HTML CSS: Show background picture/ video on hover (Custom HTML)

HTML CSS: Show background picture/ video on hover (Custom HTML)

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 291 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 Offline
    A Offline
    antonia_viola
    wrote on last edited by antonia_viola
    #1

    Hello,

    I tried a lot and nothing is working.
    Can someone help me with showing a background picture/video on hover. It's costume HTML that's why the hover Plugin is not working.

    When you hover on the title it stops and should show a background picture (clouds) fullscreen. How can I do that?

    website:
    https://antoniaviola.com/front-page

    Greetings from Constance :)

    1 Reply Last reply
    0
    • RichardR Offline
      RichardR Offline
      Richard
      Global Moderator
      wrote on last edited by
      #2

      Hey Constance @antonia_viola

      Cool website!

      Could you post all the Custom Code you are using, just to have a better understanding? :)

      Best wishes and a wonderful day

      Richard

      1 Reply Last reply
      0
      • A Offline
        A Offline
        antonia_viola
        wrote on last edited by
        #3

        Thank you so much! yes Richard of corse!!

        This is the costume code I am using for every Project-title:

        <section class="project1" id="project-1">
        <header class="project-header">
        <h3 class="project-category">DESIGN</h3>
        <h3 class="project-title1" + class="hover-title2">
        <a href="https://antoniaviola.com/in_concert">
        <span class="fx-title1 fx-title--a fx-speed--1">Fragile 070Shake</span>
        <span class="fx-title1 fx-title--b fx-speed--1">Fragile 070Shake</span>
        </a>
        </h3>

                        </header>
                       
                        
        
        
         
        <style>
        

        a{
        color: white;
        }

        a:hover {
        color: #9000f7;
        }

        .project1 {
        z-index: 5000;
        display: flex;
        flex-wrap: wrap;
        width: 140%;
        height: 8.6vw;
        }

        /* PROJECT HEADER */

        .project-header {
        display: flex;
        width: 100%;
        color: white;
        font-family: 'ACE-110-DELUXE';
        }

        .project-category {
            z-index: 1;
            width: 0%;
            padding-top: 0vw;
            padding-bottom: 0vw;
            padding-left: 0vw;
            padding-right: 0vw;
            text-align: center;
            vertical-align: middle;
        }
        
        .project-title1 {
            z-index: 2;
            white-space: nowrap;
            display: flex;
            justify-content: left;
            align-items: left;
            width: 200%;
            position: relative;
            overflow: hidden;
            padding-right: 50vw;
            cursor: pointer;
            transition: all 200ms ease;
           
        }
        
        .project-title1:hover,
        .project.state--active .project-title {
            color: #9000f7;
        }
        
        .fx-title1 {
        z-index: 100;
        display: block;
        width: 100%;
        font-size: 8vw;
        text-align: center;
        position: absolute;
        animation-duration: 7s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
        

        }

        .fx-speed--1 { animation-duration: 30s }

        .fx-title--a { animation-name: fx-title--a }
        .fx-title--b { animation-name: fx-title--b }

        @keyframes fx-title--a {
        0% { right: -100%; }
        100% { right: 0% }
        }

        @keyframes fx-title--b {
        0% { right: 0%; }
        100% { right: 100% }
        }

        .project.state--active .fx-title1,
        .project-title1:hover .fx-title1 {
        animation-play-state: paused;
        }
        </style>

        1 Reply Last reply
        0
        • RichardR Offline
          RichardR Offline
          Richard
          Global Moderator
          wrote on last edited by Richard
          #4

          Dear @antonia_viola

          Just wanted to reach out to say i haven't forgotten: Trying to manage many threads at the moment, will let you know as soon as i can - sorry about the delay! :)

          Have a wonderful day and best wishes
          Richard

          Also! this will help us in the future and others that may read :)

          <header> ( im assuming <section> ends somewhere not with this code? we need a </section> end bracket )

          <section class="project1" id="project-1">
              <header class="project-header">
          
                  <h3 class="project-category">DESIGN</h3>
          
                  <h3 class="project-title1" + class="hover-title2">
          
                        <a href="https://antoniaviola.com/in_concert">
                             <span class="fx-title1 fx-title--a fx-speed--1">Fragile 070Shake</span>
                             <span class="fx-title1 fx-title--b fx-speed--1">Fragile 070Shake</span>
                        </a>
               </h3>
          </header>
          

          CSS:

          <style>
          
             a{
                 color: white;
              }
          
             a:hover {
                 color: #9000f7;
             }
          
          .project1 {
               z-index: 5000;
               display: flex;
               flex-wrap: wrap;
               width: 140%;
               height: 8.6vw;
               }
          
          
          /* PROJECT HEADER */
          
               .project-header {
               display: flex;
               width: 100%;
               color: white;
               font-family: 'ACE-110-DELUXE';
               }
          
          .project-category {
              z-index: 1;
              width: 0%;
              padding-top: 0vw;
              padding-bottom: 0vw;
              padding-left: 0vw;
              padding-right: 0vw;
              text-align: center;
              vertical-align: middle;
          }
          
          .project-title1 {
              z-index: 2;
              white-space: nowrap;
              display: flex;
              justify-content: left;
              align-items: left;
              width: 200%;
              position: relative;
              overflow: hidden;
              padding-right: 50vw;
              cursor: pointer;
              transition: all 200ms ease;
             
          }
          
          .project-title1:hover,
                 .project.state--active .project-title {
                  color: #9000f7;
          }
          
          .fx-title1 {
              z-index: 100;
             display: block;
             width: 100%;
             font-size: 8vw;
             text-align: center;
             position: absolute;
             animation-duration: 7s;
             animation-iteration-count: infinite;
             animation-timing-function: linear;
            }
          
          .fx-speed--1 { animation-duration: 30s }
          
          .fx-title--a { animation-name: fx-title--a }
          .fx-title--b { animation-name: fx-title--b }
          
          
          @keyframes fx-title--a {
          0% { right: -100%; }
          100% { right: 0% }
          }
          
          @keyframes fx-title--b {
          0% { right: 0%; }
          100% { right: 100% }
          }
          
          .project.state--active .fx-title1,
          .project-title1:hover .fx-title1 {
          animation-play-state: paused;
          }
          
          </style>
          

          Best :)

          A 1 Reply Last reply
          0
          • RichardR Richard

            Dear @antonia_viola

            Just wanted to reach out to say i haven't forgotten: Trying to manage many threads at the moment, will let you know as soon as i can - sorry about the delay! :)

            Have a wonderful day and best wishes
            Richard

            Also! this will help us in the future and others that may read :)

            <header> ( im assuming <section> ends somewhere not with this code? we need a </section> end bracket )

            <section class="project1" id="project-1">
                <header class="project-header">
            
                    <h3 class="project-category">DESIGN</h3>
            
                    <h3 class="project-title1" + class="hover-title2">
            
                          <a href="https://antoniaviola.com/in_concert">
                               <span class="fx-title1 fx-title--a fx-speed--1">Fragile 070Shake</span>
                               <span class="fx-title1 fx-title--b fx-speed--1">Fragile 070Shake</span>
                          </a>
                 </h3>
            </header>
            

            CSS:

            <style>
            
               a{
                   color: white;
                }
            
               a:hover {
                   color: #9000f7;
               }
            
            .project1 {
                 z-index: 5000;
                 display: flex;
                 flex-wrap: wrap;
                 width: 140%;
                 height: 8.6vw;
                 }
            
            
            /* PROJECT HEADER */
            
                 .project-header {
                 display: flex;
                 width: 100%;
                 color: white;
                 font-family: 'ACE-110-DELUXE';
                 }
            
            .project-category {
                z-index: 1;
                width: 0%;
                padding-top: 0vw;
                padding-bottom: 0vw;
                padding-left: 0vw;
                padding-right: 0vw;
                text-align: center;
                vertical-align: middle;
            }
            
            .project-title1 {
                z-index: 2;
                white-space: nowrap;
                display: flex;
                justify-content: left;
                align-items: left;
                width: 200%;
                position: relative;
                overflow: hidden;
                padding-right: 50vw;
                cursor: pointer;
                transition: all 200ms ease;
               
            }
            
            .project-title1:hover,
                   .project.state--active .project-title {
                    color: #9000f7;
            }
            
            .fx-title1 {
                z-index: 100;
               display: block;
               width: 100%;
               font-size: 8vw;
               text-align: center;
               position: absolute;
               animation-duration: 7s;
               animation-iteration-count: infinite;
               animation-timing-function: linear;
              }
            
            .fx-speed--1 { animation-duration: 30s }
            
            .fx-title--a { animation-name: fx-title--a }
            .fx-title--b { animation-name: fx-title--b }
            
            
            @keyframes fx-title--a {
            0% { right: -100%; }
            100% { right: 0% }
            }
            
            @keyframes fx-title--b {
            0% { right: 0%; }
            100% { right: 100% }
            }
            
            .project.state--active .fx-title1,
            .project-title1:hover .fx-title1 {
            animation-play-state: paused;
            }
            
            </style>
            

            Best :)

            A Offline
            A Offline
            antonia_viola
            wrote on last edited by
            #5

            @Richard-K Alright no problem! Respond when you have time and thank you very much :)!

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

              Dear @antonia_viola

              Ok im back, i see what your doing now with the code, however what do you wish to achieve again, sorry i dont understand.
              When i hover over a title i get an image in the background, you need this to be fullscreen? or something else im missing? :)

              Script:

               
               
                  //get project element
                  const project5 = document.getElementById('project-5');
                  
                  //set url of the background image
                  const imageProject5 = 'https://antoniaviola.com/wp-content/uploads/2020/12/website81.jpg';
                  
                  //add listeners for image
                  try{
                      window.addHoverBackgroundImage(project5, imageProject5);
                  }catch(e){
                      console.log("Add hover bg img not found :(");
                  }
                  
              

              Best
              Richard

              1 Reply Last reply
              0
              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
              arminunruhA
              arminunruh
              F
              francesco
              L
              lurchifon
              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