Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2009
    Posts
    164
    Thanks
    75
    Thanked 1 Time in 1 Post

    Adding additional class

    Hi, I am using the JQuery one page nav plugin. If the current menu item is active, the plugin adds a class called current. I need to add a new class alongside this, how would I go about doing this? I have looked at the plugin code and I know how to replace the current class, but not to sure how to add to it. I was hoping there was a way to add some of my own code which looks for the current class, and if it finds it, adds an additional class next to it.

    Would this be possible?

    Thanks

  • #2
    New Coder
    Join Date
    Dec 2011
    Posts
    87
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Code:
    $('.active').addClass('current');
    However, the active html menu tag is identified (I'm guessing it has a class called 'active').


    and if you want to add code to something that has a class:

    Code:
    if $('div').hasClass('current') {
       // Add New Code Here:
    }
    Last edited by Strider64; 05-24-2014 at 01:23 PM.
    True courage is about knowing not when to take a life, but when to spare one. PDO Tutorial


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •