2

is there any way in magento to use this method method="unsetChild" in layout.xml file with some conditions? I need to unsetChild if the window width is less than 760px?

 <action  method="unsetChild" ><name>catalog.topnav</name></action>

Thank you

1 Answer 1

1

No, the layout is built server side, you should use CSS media queries instead to hide the navigation with display:none.

4
  • thank you I know this? but i want to use two different top menu's for desktop and mobile, one is an extension and one is the default magento menu. If both are enabled i don;t have the same results, so i need to unset one, foud something like this but is not work: <action method="unsetChild"><name>catalog.topnav</name><params>media="only screen and (min-width: 767px)"</params></action>
    – Robert
    Commented Jul 8, 2015 at 10:02
  • 1
    Not possible with layout, you have to render both menus and use CSS to decide which is shown. Commented Jul 8, 2015 at 10:03
  • if do this one of the menu will not work
    – Robert
    Commented Jul 8, 2015 at 10:07
  • i just send to you my website address in your info@s.... email, please take a look in the desktop mode then resize your browser for mobile, in the mobile mode if i don;t use the unset the categories won't display
    – Robert
    Commented Jul 8, 2015 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.