The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
2 posters

    [Solved] Make specific hover change for specific topics.

    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Solved [Solved] Make specific hover change for specific topics.

    Post by Ace 1 May 26th 2015, 1:39 pm

    Uh, I wanna know how to make topics with a specific line of text change into a specific color.

    For example, topics with "solved" in them, will hover to green and
     Topics with "unsolved" will hover to red.

    Can someone tell me how to do this? If not can you tell me how to make a whole specific thread like "Application #1 [Solved]" fade to green?

    Thanks Very Happy


    Last edited by Ace 1 on May 27th 2015, 1:14 pm; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: [Solved] Make specific hover change for specific topics.

    Post by Ange Tuteur May 26th 2015, 9:06 pm

    That would require javascript to perform a search of the node's textual content. Then if it contains a certain sequence of characters, you can add a classname to it. Here's an example using a regular expression + loop for the links.

    - placement should be in all the pages or sub-forums
    Code:
    $(function() {
      for (var a, b = document.getElementsByTagName('A'), i = 0; a = b[i]; i++) {
        if (/\[solved\]/i.test(a.innerHTML)) a.className += ' solved';
      }
    });

    Then you should be able to use CSS :
    Code:
    a.solved:hover { color:green !important }
    Ace 1
    Ace 1
    Helper
    Helper


    Male Posts : 843
    Reputation : 64
    Language : English - French?
    Location : Druid Hill Park

    Solved Re: [Solved] Make specific hover change for specific topics.

    Post by Ace 1 May 27th 2015, 1:12 pm

    @Ange Tuteur thanksya so so so much! ;D

    Solved
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: [Solved] Make specific hover change for specific topics.

    Post by Ange Tuteur May 27th 2015, 9:33 pm

    You're welcome Wink

    Topic archived

      Current date/time is November 11th 2024, 3:10 pm