2
I have a code in jquery that does the following, it creates a class after Hover, until then it is working normally, but as I will have to replicate this action elsewhere but will change the css properties of each Section, in the case of four, only that I didn’t want to have to replicate the same code over and over again, someone knows a way to improve this code so it doesn’t get repetitive ?
$('.bg_hover').hover(
function(){
$(this).addClass('ativo');
},
function(){
$(this).removeClass('ativo');
}
);
$('.bg_hover_dois').hover(
function(){
$(this).addClass('ativo_dois');
},
function(){
$(this).removeClass('ativo_dois');
}
);
Do you have control over HTML? do you really need to have different classes? Why not have the same class for everyone? And this class
ativo
does what? can’t do everything without jQuery? (i.e.: only with CSS)– Sergio
Too bad you took an answer before you cleared up any doubts I put here. Next time I suggest to clarify the problem better, you will learn more and the question will be more useful to others who have the same problem
– Sergio