Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Organic Tabs: Change class for active link

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #176600
    mgk89
    Participant

    Hello,

    I’m using the https://css-tricks.com/organic-tabs/ tool which is very helpful.

    So far i do have a question:

    How would it be possible to change the background color for the current (clicked) <li> element, such as the ulelements do when clicked?

    In fact there should be the class for the active link changed and after clicking on a new link the class should be removed and changed for the new link.

    I hope my question is coherent :)

    thank you very much for your help!

    cheers
    mgk89

    #176604
    mgk89
    Participant

    hi,

    I would like to change the background color of the active li -Element.

    Thank you

    #176608
    mgk89
    Participant

    Hmm, thank you for your answer.

    Unfortunately both versions don’t work.

    I’m not sure if ul.nav li a.current really refers to the active li – element.

    I guess the solution would be probably the same as for the ul – elements: if an element is clicked, a certain class is assigned for the element that was clicked while all other elements change the class to the default one.

    I think that was the solution for the ul – elements?

    Thank you

    #176618
    Paulie_D
    Member

    Switching classes is a JS/JQ function..and a pretty simple one at that.

    If you post your code in a Codepen.io demo we can be more precise.

    #176619
    mgk89
    Participant

    hello,

    thank you for your help!

    I tried my best:

    http://codepen.io/anon/pen/amDJI (sorry this is the first time I’m trying this)

    on codepen the script does not work properly, on my website http://www.maxk.at/42 it works without any problems (except the missing change of color of the active link)

    thank you

    #176621
    mgk89
    Participant

    I would like to have the active link (so after you click) to be coloured until a different link is clicked. Exactly the same it is with the categories on top.

    #176623
    mgk89
    Participant

    This is just perfect!!!!

    Thank you very very much!

    #176800
    mgk89
    Participant

    Thank you, implementing the changes were no problem!

    in fact I do have another question:

    it would be great to have a function to hide the list-wrap DIV, to size down the navigation. It tried with another category as a link but the problem is that though I hide the list-wrap DIV the size of the example-one div (the whole navigation) stays the same.

    would it be easy to create a category in the navigation bar to hide/unhide the list-wrap with resizing?

    thank you for your help!

    #176803
    Paulie_D
    Member

    It would be better is you started a new thread for this question as it’s not related to your original problem.

    #176931
    mgk89
    Participant

    wow, thank you very much for your quick help! I will try my best to improve it to a kind of “toggle button” that for hiding and showing and changing the name…

    #176957
    mgk89
    Participant

    hey,

    maybe you would be so kind as to help me again :)

    I tried to change “addClass” to “toggleClass” but that does not seem to work correctly, because the content of the last opened list disappears when clicking on a different ul – Element.

    Do you think it is a lot of work to change the function of the minimise button to a kind of toggle-button?

    thank you for your answer!

    #176993
    mgk89
    Participant

    thank you very much for your work.

    Though it looks perfectly on codepen I could not get it to work correctly on my page. I tried copying the files twice, so I do not know what the reason could be.

    Maybe you want to take a look at http://www.maxk.at/42

    Thanks a lot!!!

    #176999
    mgk89
    Participant

    haha, very strange – i just reloaded it for the sixth time and suddely it worked.
    shame on me!

    thank you :)

    #177003
    mgk89
    Participant

    yeah, I guess this was the reason ;)

    #177009
    mgk89
    Participant

    just one las thing I noticed:

    if you downsize the browsersize to mobile view you will notice that the distance between the two rows of categories disappears if you minimize the menu.

    http://www.maxk.at/42

    it just occurs when you minimize it with a very small browser width.

    do you have any ideas what causes that?

Viewing 15 posts - 1 through 15 (of 16 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.