ShoutBox!

 

Ken

2021 Oct 13 11:14:20
Captain Kirk is now officially an Astronaut!!!  :heart: 😍
 

Ken

2021 Oct 09 05:09:32
 

Ken

2021 Aug 14 04:29:02
... a little late, but what the hey!  laughing7

 

Ken

2021 Aug 06 07:47:47
 

Ken

2021 Jul 30 22:30:30
 

Ken

2021 Jul 02 09:38:25
Hahahaha!  :banana:
 

Skhilled

2021 Jul 02 08:15:50
It's that day again. :)
 

Skhilled

2021 Jun 19 11:22:12
LOL
 

Ken

2021 Jun 18 15:07:53
 

Ken

2021 Jun 15 09:36:59
Just chillin  laughing7

Recent Topics

Author Topic: How To Make Things Change Colors Upon Hovering  (Read 1189 times)

0 Members and 1 Guest are viewing this topic.

Offline Skhilled (OP)

  • Administrator
  • *
  • Posts: 6771
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
How To Make Things Change Colors Upon Hovering
« on: August 17, 2019, 09:07:02 AM »
I've found a way to do this in the SMF 2.1 RC2 version but will work in any modern version of SMF.

I found this by accident working on a new theme that uses the ".bg.even/.bg.odd" code in index.css. There's code for alternating colors like in a topic, in the admin, etc. For instance, open any topic with more than one post in it on this forum. You'll notice that the posts alternate between two colors. That part uses the ".bg.even/.bg.odd" code or ".windowbg/.windowbg2" (mostly for SMF 2.0.15).

You can see it in action here on the help, calendar, and member pages:

https://skhilled.com/rc2/index.php?theme=14

What you'll need to do is create a "hover" for the code in question so it changes it to another when you put your mouse over it. ;) The following is code from 2.1 RC2:

Code: [Select]
/* Here comes the glory... */
.windowbg:nth-of-type(even), .bg.even {
background: #1f1f1f;
}
.windowbg:nth-of-type(odd), .bg.odd {
background: #282828;
}

Change it to this:

Code: [Select]
/* Here comes the glory... */
.windowbg:nth-of-type(even), .bg.even {
background: #1f1f1f;
}
.windowbg:nth-of-type(even):hover, .bg.even {
background: #000;
}
.windowbg:nth-of-type(odd), .bg.odd {
background: #282828;
}
.windowbg:nth-of-type(odd):hover, .bg.odd {
background: #000;
}

Just change the background of the following code to whatever you want the hover color to be:

Code: [Select]
background: #000;

Offline Ken

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 10214
  • Gender: Male
  • View Gallery
Re: How To Make Things Change Colors Upon Hovering
« Reply #1 on: August 17, 2019, 11:47:22 AM »
Neat looking trick.  :thumbup:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled (OP)

  • Administrator
  • *
  • Posts: 6771
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: How To Make Things Change Colors Upon Hovering
« Reply #2 on: August 17, 2019, 12:24:20 PM »
Next I plan on trying to make the boards on the home page do the same.  :wink: