Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError: rgba is not defined

I am attempting to make a simple animation that would change a color of a font, but I am struggling with said reference error. Can anyone point me to the right direction, please? I have already installed color animation jQuery-plugin.

HTML:

<ul class="menu"> 
<li><a href="">ABOUT US</a></li>        
<li><a href="">CONTACT</a></li>   
</ul>

JS:

$('.menu').find('a').on('mouseenter', function() {
    $(this).css({color: rgba(239, 231, 35, 0.8)});
});
like image 747
Shinrin Yoku Avatar asked Feb 17 '17 21:02

Shinrin Yoku


2 Answers

Your JavaScript code is missing some quotes.

Change this line:

$(this).css({color: rgba(239, 231, 35, 0.8)});

To this:

$(this).css({'color':'rgba(239, 231, 35, 0.8)'});
like image 93
AndrewL64 Avatar answered Nov 01 '22 21:11

AndrewL64


Since you're using jQuery color animation, then the below code would do the trick:

$(this).animate({color: 'rgba(239, 231, 35, 0.8)'});
like image 3
Den Isahac Avatar answered Nov 01 '22 21:11

Den Isahac