JQuery hover error

Joined
Aug 21, 2023
Messages
32
Reaction score
0
Hi.
I want the div element on hover to animate to a different color via jQuery but it won't work. I know i can do this via css animations but I want it this way.I've done this way(jQuery) in another code and it worked fine.
This is in short my html:
HTML:
<div class="services">
      <div class="col-md-4" id="logodesign"><a href="contact.html">
      <img src="images/LOGOSBUNDLE2.jpg" alt="logoservices" class="img-fluid">
          <h1 class="blink">NEED LOGO DESIGN!</h1><p class="blink">Classic, modern, vintage, bold, ...</p></a></div></div>

and the script part:
JavaScript:
$(() => {
   $('div.col-md-4#logodesign').hover(function() {
    $(this).animate({
      backgroundColor: '#041826',
      color: '#000'
    },1000)
   }, function() {
    $(this).animate({
      backgroundColor: 'orange',
      color: '#fff'
    },1000);
   });
  });;
and the web inspector errors:
Screenshot 1445-02-12 at 16.35.49.png
 
Joined
Jul 4, 2023
Messages
366
Reaction score
41
... and the orange color for some reason
check this
JavaScript:
  $(() => {
    $('div#logodesign').hover(function() {
      $(this).animate({
        backgroundColor: '#041826',
        color: '#000'
      }, 1000, function() {
        $(this).animate({
          backgroundColor: 'orange',
          color: '#fff'
        }, 1000);
      });
    });
  });
 
Joined
Aug 21, 2023
Messages
32
Reaction score
0
check this
JavaScript:
  $(() => {
    $('div#logodesign').hover(function() {
      $(this).animate({
        backgroundColor: '#041826',
        color: '#000'
      }, 1000, function() {
        $(this).animate({
          backgroundColor: 'orange',
          color: '#fff'
        }, 1000);
      });
    });
  });
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top