1

I'm trying to adapt the Luma Theme for my needs and move some elements in layout. I add a default.xml file in my Child Theme and add those lines :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
      <move element="minicart" destination="header.container" before="-" />
      <referenceBlock name="top.search" remove="true"/>
    </body>
</page>

The minicart is now on the header container but is there a directive to apply these changes only for Desktop and not for Mobile view ?

0

XML layout files do not care about platform or screen size. You'll have to use CSS and JS to get the style you're going for.

Documentation about moving elements with JS

The responsive.js script implements specific responsive functions for the Blank and Luma themes.

| improve this answer | |
  • Meaning that I should not move my block in the layout but only by CSS ? – urbansurfers Mar 5 '18 at 20:52
  • You may still find it useful to move the element using xml so that it takes less work in css and js for your specific view. You can also consider cloning elements and then hiding/showing on the appropriate screens – jamil Mar 5 '18 at 21:13
  • Added a link to my answer – jamil Mar 5 '18 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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