Fixed Header and Mega Menu












0














I'm new at magento. I'm using luma theme as a blank. I want to fix header and mega menu when page scroll down.
Thanks for your helps.










share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0














    I'm new at magento. I'm using luma theme as a blank. I want to fix header and mega menu when page scroll down.
    Thanks for your helps.










    share|improve this question
















    bumped to the homepage by Community 2 days ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0







      I'm new at magento. I'm using luma theme as a blank. I want to fix header and mega menu when page scroll down.
      Thanks for your helps.










      share|improve this question















      I'm new at magento. I'm using luma theme as a blank. I want to fix header and mega menu when page scroll down.
      Thanks for your helps.







      magento2 javascript menu header






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 12 '17 at 11:08









      Nitin Pawar

      77111435




      77111435










      asked Jan 12 '17 at 11:05









      copencopen

      11




      11





      bumped to the homepage by Community 2 days ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 2 days ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Have you tried position:fixed in css file?



          frontend/Magento/luma/en_US/css/styles-l.css






          share|improve this answer































            0














            Create a custom.js file and place it in your app/design/Custom/theme/web/js folder. Then, from Magento_Theme/layout/default_head_blocks.xml link to your custom JS file like this:



            <head>
            <link src="js/custom.js" />
            </head>


            Alternatively, you can place the link in Admin >> Content >> Configuration > on the default scope to the right of your theme name click on "edit". Open the HTML head tab and in the "Scripts and Style Sheets" box place your script link.



            Inside your custom.js file add the following code:



            $(document).ready(
            function() {
            var mn = $(".page-header");
            var mns = "main-nav-scrolled";

            $(window).scroll(function() {
            if( $(this).scrollTop() > 0 ) {
            mn.addClass(mns);
            } else {
            mn.removeClass(mns);
            }
            });
            });


            Use css class .main-nav-scrolled to style the fixed menu and add any transitions and animations.






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "479"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154441%2ffixed-header-and-mega-menu%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Have you tried position:fixed in css file?



              frontend/Magento/luma/en_US/css/styles-l.css






              share|improve this answer




























                0














                Have you tried position:fixed in css file?



                frontend/Magento/luma/en_US/css/styles-l.css






                share|improve this answer


























                  0












                  0








                  0






                  Have you tried position:fixed in css file?



                  frontend/Magento/luma/en_US/css/styles-l.css






                  share|improve this answer














                  Have you tried position:fixed in css file?



                  frontend/Magento/luma/en_US/css/styles-l.css







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 13 '17 at 4:40









                  Ankit Shah

                  4,655861139




                  4,655861139










                  answered Jan 12 '17 at 11:45









                  AytacAytac

                  112




                  112

























                      0














                      Create a custom.js file and place it in your app/design/Custom/theme/web/js folder. Then, from Magento_Theme/layout/default_head_blocks.xml link to your custom JS file like this:



                      <head>
                      <link src="js/custom.js" />
                      </head>


                      Alternatively, you can place the link in Admin >> Content >> Configuration > on the default scope to the right of your theme name click on "edit". Open the HTML head tab and in the "Scripts and Style Sheets" box place your script link.



                      Inside your custom.js file add the following code:



                      $(document).ready(
                      function() {
                      var mn = $(".page-header");
                      var mns = "main-nav-scrolled";

                      $(window).scroll(function() {
                      if( $(this).scrollTop() > 0 ) {
                      mn.addClass(mns);
                      } else {
                      mn.removeClass(mns);
                      }
                      });
                      });


                      Use css class .main-nav-scrolled to style the fixed menu and add any transitions and animations.






                      share|improve this answer


























                        0














                        Create a custom.js file and place it in your app/design/Custom/theme/web/js folder. Then, from Magento_Theme/layout/default_head_blocks.xml link to your custom JS file like this:



                        <head>
                        <link src="js/custom.js" />
                        </head>


                        Alternatively, you can place the link in Admin >> Content >> Configuration > on the default scope to the right of your theme name click on "edit". Open the HTML head tab and in the "Scripts and Style Sheets" box place your script link.



                        Inside your custom.js file add the following code:



                        $(document).ready(
                        function() {
                        var mn = $(".page-header");
                        var mns = "main-nav-scrolled";

                        $(window).scroll(function() {
                        if( $(this).scrollTop() > 0 ) {
                        mn.addClass(mns);
                        } else {
                        mn.removeClass(mns);
                        }
                        });
                        });


                        Use css class .main-nav-scrolled to style the fixed menu and add any transitions and animations.






                        share|improve this answer
























                          0












                          0








                          0






                          Create a custom.js file and place it in your app/design/Custom/theme/web/js folder. Then, from Magento_Theme/layout/default_head_blocks.xml link to your custom JS file like this:



                          <head>
                          <link src="js/custom.js" />
                          </head>


                          Alternatively, you can place the link in Admin >> Content >> Configuration > on the default scope to the right of your theme name click on "edit". Open the HTML head tab and in the "Scripts and Style Sheets" box place your script link.



                          Inside your custom.js file add the following code:



                          $(document).ready(
                          function() {
                          var mn = $(".page-header");
                          var mns = "main-nav-scrolled";

                          $(window).scroll(function() {
                          if( $(this).scrollTop() > 0 ) {
                          mn.addClass(mns);
                          } else {
                          mn.removeClass(mns);
                          }
                          });
                          });


                          Use css class .main-nav-scrolled to style the fixed menu and add any transitions and animations.






                          share|improve this answer












                          Create a custom.js file and place it in your app/design/Custom/theme/web/js folder. Then, from Magento_Theme/layout/default_head_blocks.xml link to your custom JS file like this:



                          <head>
                          <link src="js/custom.js" />
                          </head>


                          Alternatively, you can place the link in Admin >> Content >> Configuration > on the default scope to the right of your theme name click on "edit". Open the HTML head tab and in the "Scripts and Style Sheets" box place your script link.



                          Inside your custom.js file add the following code:



                          $(document).ready(
                          function() {
                          var mn = $(".page-header");
                          var mns = "main-nav-scrolled";

                          $(window).scroll(function() {
                          if( $(this).scrollTop() > 0 ) {
                          mn.addClass(mns);
                          } else {
                          mn.removeClass(mns);
                          }
                          });
                          });


                          Use css class .main-nav-scrolled to style the fixed menu and add any transitions and animations.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Oct 17 '17 at 16:34









                          Iveta AllogenesIveta Allogenes

                          10011




                          10011






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154441%2ffixed-header-and-mega-menu%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              An IMO inspired problem

                              Management

                              Investment