How can i shorted this jquery by using each() function? or have another method to shorted this jquery?
$("div.body-t-option-1").hover(function() {
$(".body-t-img-2,.body-t-img-3,.body-t-img-4").hide();
$(".body-t-img-1").show();
$(".body-t-img-1").addClass('animated fadeInLeft');
});
$("div.body-t-option-2").hover(function() {
$(".body-t-img-1,.body-t-img-3,.body-t-img-4").hide();
$(".body-t-img-2").show();
$(".body-t-img-2").addClass('animated fadeInLeft');
});
$(".body-t-option-3").hover(function() {
$(".body-t-img-1,.body-t-img-2,.body-t-img-4").hide();
$(".body-t-img-3").show();
$(".body-t-img-3").addClass('animated fadeInLeft');
});
$(".body-t-option-4").hover(function() {
$(".body-t-img-1,.body-t-img-2,.body-t-img-3").hide();
$(".body-t-img-4").show();
$(".body-t-img-4").addClass('animated fadeInLeft');
});
how are u? suggestion, currently it is recommended to use the events as follows
$(document).on('hover', 'div.body-t-option-1', () => {
//code...
});
$(document).on('click', '#something', () => {
//code...
});
now, regarding the question, let me suggest that you reformulate it by adding more information for example with an html template in order to understand your desired output