Andy Holmes
Andy Holmes

Reputation: 8077

jQuery hover toggleclass issue

i have some code that works perfect for my hover states. However, if the link is already active, i.e ArrowHover is already attached to the div when i hover over it obviously it removes ArrowHover due to the toggleclass in the jquery. How can i make sure this doesn't happen on links already active?

$("#JobApplications").hover(function()
    {
         $("#JobApplicationsArrow.Arrow").toggleClass('ArrowHover')
    }
)

Upvotes: 0

Views: 222

Answers (2)

Andy Holmes
Andy Holmes

Reputation: 8077

Fixed it using css techniques instead of jQuery. Cheers anyways Adam!

Upvotes: 0

adam
adam

Reputation: 2970

It would be helpful if we could see your HTML object, to know if it is an anchor tag or not... but assuming it is an anchor tag, try something along with this concept:

if ( $("#JobApplicationsArrow.Arrow").href != window.location.href ) {
    $("#JobApplicationsArrow.Arrow").toggleClass('ArrowHover')
}

It is a modified version from this post:

Upvotes: 1

Related Questions