Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML hyperlink remain changed color after mouse has moved over link

I was wondering, I have links that change blue when a mouse hovers over them. Would it be possible to make them remain blue a few seconds after the mouse has moved away? I'm guessing this would be possible with jquery? Thanks!

like image 430
thegreyspot Avatar asked Dec 12 '22 21:12

thegreyspot


1 Answers

An alternative might be the CSS transition-duration property. This won't keep it a solid color for the specified time but it can allow a transition from one color to another to take a number of seconds for example. This may not be supported by some browsers visiting the page so the other answers using jQuery are great for that.

a {
    color: red;
    transition-duration: 5s;
    -moz-transition-duration: 5s;
    -webkit-transition-duration: 5s;
}

a:hover {
    color: blue;
}
like image 146
alexcoco Avatar answered Jan 13 '23 14:01

alexcoco