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. Simple text description hover?

Simple text description hover?

Scheduled Pinned Locked Moved General Discussion
2 Posts 2 Posters 595 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.
  • V Offline
    V Offline
    vthevoz
    wrote on last edited by vthevoz
    #1

    Hello!

    I'm setting up a really simple 2-column page, with images on the left and on the right (or carousels or videos when relevant) and wish to have their captions display upon mouse click (or hover if it's easier).

    Ideally in a pop-up contained box (which is 10% height of the images and same width as pictures, white background), bottom aligned with the pictures, text aligned to the left (as screenshot attached)

    Is there an easy way to do this without jQuery requests and CSS styling (I think not…). What would your easiest suggestion be?

    Thanks in advance!
    V.

    Screenshot 2022-02-16 at 12.57.04.jpeg

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

      Dear @vthevoz

      This should set you in the right direction, sorry that i cannot help you completely through the process. You will see what's happening here though and what to do further:

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

      https://laytheme.com/documentation/custom-javascript.html


      Gridder Setup:
      Screen Shot 2022-02-22 at 7.25.06 PM.png

      Important to note that you should make use of Lay Theme's built in captions as this should be much easier than adding HTML text areas under the images.

      The Image element should be given either a Custom Class or ID so we can target it easier:

      Screen Shot 2022-02-22 at 7.24.25 PM.png


      Custom CSS:

      .magic-caption .caption{
          display:none;
      }
      
      .caption-visible{
          display:block !important;
      }
      

      JQuery:

      <script>
          window.laytheme.on("newpageshown", function(layoutObj, type, obj){
              
              jQuery(".magic-caption").click(function(){
              jQuery(".caption").toggleClass("caption-visible");
              });
      
          });
      </script>
      

      Reference:

      https://www.w3schools.com/jquery/html_toggleclass.asp


      Result:

      Screen Shot 2022-02-22 at 7.45.50 PM.png

      Screen Shot 2022-02-22 at 7.46.03 PM.png

      The Class caption-visible is added to the caption. This comes with new CSS information that tells this HTML element now to be visible.

      NOTE: you will see that the caption height created by becoming visible also affects the image to it's right horizontally. Both are pushed upwards. This is something to figure out 🌝


      Hope this sets you in the right direction & best wishes
      Richard
      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
      A
      alasdair17
      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