I'm new to jQuery and I'm looking for a simple script (or maybe there's a simpler method) where if a user hovers over an element, another element's css property changes.
For example, hover over this image and "border-bottom" on another element changes color or something, etc. thanks
use the hover property
$('#elementA').hover(function(){
$('#elementB').addClass('active');
},function(){
$('#elementB').removeClass('active');
});
then style the active class in your css
What have you tried so far?
Here is the jQuery documentation on hover. Basically, provide a selector to the object that you want to hover over (and leave, if you don't want a permanent effect). Then, inside the event's function, select the object that you want changed and update its CSS settings. (Or, if you have a class for it written, update to the new class.)
If you want to add some code that you have tried to write (update your post), I would be more than happy to help you with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With