say you have this code:
$("#sub_nav_home1").hover(function () {
$("#homepage").removeClass();
$("#homepage").addClass("homepage1");
});
$("#sub_nav_home2").hover(function () {
$("#homepage").removeClass();
$("#homepage").addClass("homepage2");
});
$("#sub_nav_home3").hover(function () {
$("#homepage").removeClass();
$("#bhomepage").addClass("bhomepage3");
});
<ul class="nav sub_nav_home">
<li id="sub_nav_home1"><a href="#"><span>LINK1</span></a></li>
<li id="sub_nav_home2"><a href="#"><span>LINK2</span></a></li>
<li id="sub_nav_home3"><a href="#"><span>LINK3</span></a></li>
</ul>
IS there a way were we can only do the hover jquery functionality once, instead of one per link?
Hope that made sense
Cheers
Err, quickest way i can think of is (this will be dynamic too):
That will make the class homepage[the id number inside that’s parent] i.e. homepage1, homepage2, etc
–UPDATE–
This should work for you (but i didnt test it! Just let me know if it doesnt work)
P.S. if this works for you, make sure to give me an up vote 😉