I've been trying to learn jQuery and it's going pretty alright for me, I think. However, I can't seem to figure out how to make my coding efficient enough. Some times instead of using the callback function I do like a "double code", simply because I can't seem to figure out how to SKIP the "easing" thing, which makes me unable to use the callbacks.
I've tried to make a navbar which fades out using jQuery animate and opacity, however, sometimes when you hover over the navbar too fast it gets stuck at the opacity, and some times they just keep blinking and won't stop for a while. I can't seem to figure out how I can fix it, this is my code for the navigation bar:
<script type="text/javascript">
$(document).ready()
$("#navbar ul li.1 a").mouseover(function() {
$("#navbar ul li.1 a").animate({
opacity: 0.5
}, 500, function() {
$("#navbar ul li.1 a").mouseout(function() {
$("#navbar ul li.1 a").animate({
opacity: 1.0
}, 500, function() {
});
});
});
});
$("#navbar ul li.2 a").mouseover(function() {
$("#navbar ul li.2 a").animate({
opacity: 0.5
}, 500, function() {
$("#navbar ul li.2 a").mouseout(function() {
$("#navbar ul li.2 a").animate({
opacity: 1.0
}, 500, function() {
});
});
});
});
$("#navbar ul li.3 a").mouseover(function() {
$("#navbar ul li.3 a").animate({
opacity: 0.5
}, 500, function() {
$("#navbar ul li.3 a").mouseout(function() {
$("#navbar ul li.3 a").animate({
opacity: 1.0
}, 500, function() {
});
});
});
});
$("#navbar ul li.4 a").mouseover(function() {
$("#navbar ul li.4 a").animate({
opacity: 0.5
}, 500, function() {
$("#navbar ul li.4 a").mouseout(function() {
$("#navbar ul li.4 a").animate({
opacity: 1.0
}, 500, function() {
});
});
});
});
</script>
I hope you can help me, thank you in advance!
.stop.