Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    Hovering over text with a class changes color of all text with same class - jQuery

    General Discussion
    1
    3
    410
    Loading More Posts
    • 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.
    • DMB
      DMB last edited by

      Hi @Armin-Unruh , hope you're well :smile:

      I'm trying to write some jQuery so that whenever i hover over a class 'colorbutton' it chnages the color of all text with the same class on the page.

      I found a fiddle which does basically this (ignore the two different things i just want to do it to one class) but I cant figure out how to adapt it to work with Lay as i'm not very experienced with javascript - trying to learn.

      function highlightAllOnMouseover(className){
      $(className).mouseover(function() {
      $(className).css("opacity", 0.4);
      $(className).css("opacity", 1);
      }).mouseleave(function() {
      $(className).css("opacity", 0.4);
      });
      }
      highlightAllOnMouseover(".thing1");

      Any ideas for this?

      Heres the fiddle
      http://jsfiddle.net/aZXRM/

      DMB 1 Reply Last reply Reply Quote 0
      • DMB
        DMB @DMB last edited by

        @Armin-Unruh Actually ive got this code which seems to be right but perhaps not written properly?

        <script>
        jQuery(document).ready(function(){
        jQuery('.text1 h1').hover(
        function() {jQuery('.text1 h1').css({"color":"blue"});
        },function() {jQuery('.text1 h1').removeAttr('style');});
        </script>

        1 Reply Last reply Reply Quote 0
        • DMB
          DMB last edited by

          Actually its ok ive worked it out!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          I don't answer or check forum DMs, please just post on the forum.

          Try this to fix issues before you post:

          Use the Search Feature. Maybe there is already a solution to your issue.

          1. Update Lay Theme and all Lay Theme Addons
          2. Disable all Plugins
          3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
          4. Now see if your problem solved itself
          5. Go here, see if your problem is listed here:
          Troubleshooting

          When you post:
          1. Post a link to where the problem is
          2. If the problem is difficult to explain, post screenshots / link to a video to explain it

          Thanks!

          Online Users

          C
          L
          A
          M

          Recent Topics

          • T

            thumbnail grid categories fixed.

          • L

            BLEND MODE ON MOBILE

          • A

            A modal/pop up window displaying extra info

          • Carousel is not showing

          laytheme.com