In materializecss, how to open the slide-out menu from right rather than default left?

前端 未结 2 368
暖寄归人
暖寄归人 2021-01-24 04:38

In materialize CSS, the hamburger menu is on left by default. I changed the CSS and achieved it to right.But on clicking, the side-nav still slides out from left. I referred the

相关标签:
2条回答
  • 2021-01-24 05:19

    I've made you a fiddle here http://jsfiddle.net/8tw2u80q/3/. Hope this helps you.

      $('.button-collapse').sideNav({
          menuWidth: 300, // Default is 240
          edge: 'right', // Choose the horizontal origin
          closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
        }
      );

    You need to set edge: right.

    0 讨论(0)
  • 2021-01-24 05:19

    Here is what i meant in the comment below your question, after you initialize the menu, you can specify the correct options you want wit jquery and have the menu pop out on the right other than the left.

    <script type="text/javascript">
          $('.button-collapse').sideNav({
          menuWidth: 300, // Default is 240
          edge: 'right', // Choose the horizontal origin
          closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
        }
      );
    </script>
    

    This will move the menu to pop open on the right once you are in the correct screen size for the mobile menu to be displayed

    0 讨论(0)
提交回复
热议问题