jQuery: The Write Less, Do More JavaScript Library

Superfish - Last-child and Parent class at the same time

View: New views
2 Messages — Rating Filter:   Alert me  

Superfish - Last-child and Parent class at the same time

by Goh Hao-Wei :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

How do I get a <li> item to have both the Parent and the Last-Child
class at the same time? Reason is, I'm making use of Last-child class
to control the borders for the last item in a sub menu, but I'm having
difficulties when the last-child has its own sub menu, making it only
having the parent class without the last-child class.

Re: Superfish - Last-child and Parent class at the same time

by Charlie Tomlinson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

a bit hard to answer without knowing what method you are using to set classes...js or html markup

one method may help, using the onBeforeShow option . "this" used in a function in onBeforeShow refers to the UL about to be shown

you could try $(this).parent("li").siblings("li;last").addClass("yourLastchildClass"). Likely several other ways depending on how you're markup is generated and how you are currently setting classes

Goh Hao-Wei wrote:
Hello,

How do I get a <li> item to have both the Parent and the Last-Child
class at the same time? Reason is, I'm making use of Last-child class
to control the borders for the last item in a sub menu, but I'm having
difficulties when the last-child has its own sub menu, making it only
having the parent class without the last-child class.