Skip to content Skip to sidebar Skip to footer

Change Div Property When Hovering On Another Div?

So basically this is what I'm going to have:
Text Text Text etc.
How would I

Solution 1:

If you have jquery, then it is pretty simple (this worked for me):

$('#1').hover( function() {
    $('#bottom').addClass('over');
})

Solution 2:

First thing is don't use numbers for div ids

$("#id").hover( //mouseover idfunction () {
  $("#bottom").addClass('classname') // this function is for mouse over
  }, 
  function () {
 // this is for mouse out
  }
);

Solution 3:

Yes, you are correct. You will need some jQuery to accomplish what you want to do.

The jQuery API documentation has the exact example you are looking for if you go and check out the hover function. Go to the bottom for an example. Adjust for your own code.

Post a Comment for "Change Div Property When Hovering On Another Div?"