I have 3 divs(#carta1,#carta2 and #carta3) that are hidden (display:none), each one with different information. When the user goes over a navigation bar the corresponding div is shown.
It works fine but i think its to much code.. is there any way to make it simpler(for example to use only 1 function)?
thanks for the help!
here´s my Jquery code:
$("#frueh, #carta1").hover(function (e) {
e.preventDefault();
$("#carta1").stop().fadeIn();
},
function(){
$("#carta1").stop().fadeOut(750);
});
$("#sup, #carta2").hover(function (e) {
e.preventDefault();
$("#carta2").stop().fadeIn();
},
function(){
$("#carta2").stop().fadeOut(500);
});
$("#sal, #carta3").hover(function (e) {
e.preventDefault();
$("#carta3").stop().fadeIn();
},
function(){
$("#carta3").stop().fadeOut(750);
});
and here´s the Html list:
<ul id="speise">
<li><a id="frueh" href="">Frühstück</a></li>
<li><a id="sup" href="">Suppen</a></li>
<li><a id="sal" href="">Salate</a></li>
</ul>
Aucun commentaire:
Enregistrer un commentaire