Here's something simple I am doing. I have some div's, each called ".item-1", ".item-2", etc. When the user hovers on ".item-1", the "#city-info-1" div slides up, while it slides down when the user hovers off. I knew enough to do that, and know enough that the way I've coded it isn't the best way possible. Just curious how others would do this, so I don't have to repeat practically the same code every time. Appreciate any suggestions :)
$('#city-info-1, #city-info-2, #city-info-3, #city-info-4, #city-info-5, #city-info-6, #city-info-7').hide();
$('.item-1').hover(function() {
$('#city-info-1').stop().slideToggle(400);
}, function() {
$('#city-info-1').hide();
});
$('.item-2').hover(function() {
$('#city-info-2').stop().slideToggle(400);
}, function() {
$('#city-info-2').hide();
});
$('.item-3').hover(function() {
$('#city-info-3').stop().slideToggle(400);
}, function() {
$('#city-info-3').hide();
});
$('.item-4').hover(function() {
$('#city-info-4').stop().slideToggle(400);
}, function() {
$('#city-info-4').hide();
});
$('.item-5').hover(function() {
$('#city-info-5').stop().slideToggle(400);
}, function() {
$('#city-info-5').hide();
});
$('.item-6').hover(function() {
$('#city-info-6').stop().slideToggle(400);
}, function() {
$('#city-info-6').hide();
});
$('.item-7').hover(function() {
$('#city-info-7').stop().slideToggle(400);
}, function() {
$('#city-info-7').hide();
});