Jquery menu with less code
- by Sergio
I'm using Jquery for menu created like:
<div class="prof_info1">home</div><div class="prof_info2">info2</div><div class="prof_info3">info3</div>
And Jquery code like:
$(document).ready(function(){
$(".prof_info1").unbind("click").click(function(event) {
$("#main").html('<img src="img/spin.gif" class="spin">');
location.replace("?&id=<?=$id?>")
return false;
});
$(".prof_info2").unbind("click").click(function(event) {
$("#main").html('<img src="img/spin.gif" class="spin">');
$("#main").load('?a=2&id=<?=$id?>');
return false;
});
$(".prof_info3").unbind("click").click(function(event) {
$("#glavni").html('<img src="img/spin.gif" class="spin">');
$("#glavni").load('?a=3&id=<?=$id?>');
return false;
});
});
Is there any easier way to do write this Jquery code and make it with less code?
Something like
if click somethind{
...
}elseif{
....}