How to change a search input box into a search icon as in mobile viewdisplay some texts under “Search...

Why is this plane circling around the Lucknow airport every day?

What are some noteworthy "mic-drop" moments in math?

Rejected in 4th interview round citing insufficient years of experience

Fourth person (in Slavey language)

Why would one plane in this picture not have gear down yet?

Why is Beresheet doing a only a one-way trip?

Best approach to update all entries in a list that is paginated?

Is having access to past exams cheating and, if yes, could it be proven just by a good grade?

Why does Captain Marvel assume the people on this planet know this?

Do f-stop and exposure time perfectly cancel?

Offered promotion but I'm leaving. Should I tell?

What to do when during a meeting client people start to fight (even physically) with each others?

What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?

A three room house but a three headED dog

Who deserves to be first and second author? PhD student who collected data, research associate who wrote the paper or supervisor?

"One can do his homework in the library"

Why is there a voltage between the mains ground and my radiator?

Can Mathematica be used to create an Artistic 3D extrusion from a 2D image and wrap a line pattern around it?

Replacing Windows 7 security updates with anti-virus?

Peter's Strange Word

Built-In Shelves/Bookcases - IKEA vs Built

Latest web browser compatible with Windows 98

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

Do I really need to have a scientific explanation for my premise?



How to change a search input box into a search icon as in mobile view


display some texts under “Search box” in magentoHow do I add a Magento search bar into a Wordpress site?Extend Header (logo, search box and cart) in Magento 2Magento2 sign-in link move to the search box NearSearch box placeholder not chanigngText in search boxWanted to change my account text to icon in headerMake search bar visible in mobile viewMagento 2 : How to move the search box next to logo title [SOLVED]Can I add the search box to a template without xml?













0















How to have a search icon in the place of search box in the header, once the search icon is clicked the search box has to drop down, can some one help me how to do it










share|improve this question














bumped to the homepage by Community 6 mins ago


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




















    0















    How to have a search icon in the place of search box in the header, once the search icon is clicked the search box has to drop down, can some one help me how to do it










    share|improve this question














    bumped to the homepage by Community 6 mins 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








      How to have a search icon in the place of search box in the header, once the search icon is clicked the search box has to drop down, can some one help me how to do it










      share|improve this question














      How to have a search icon in the place of search box in the header, once the search icon is clicked the search box has to drop down, can some one help me how to do it







      search header magento-2.2.1






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 4 '17 at 8:19









      anirvananirvan

      1917




      1917





      bumped to the homepage by Community 6 mins 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 6 mins ago


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
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Example: Default magento search form : only required part shown in example, in phtml only update the attribute of elements



          Form Element add extra class = searchbox



          Form Input search box add extra class = searchbox-input & onkeyup=buttonUp()



          Form Submit button extra class = searchbox-submit



          And Next to submit button add a span element



          <span class="searchbox-icon">Find</span>



          <form class="form minisearch searchbox" id="search_mini_form" ...>
          <div class="field search">
          <label class="label" ... >
          <span>Search</span>
          </label>
          <div class="control">
          <input id="search" type="text" ... class="input-text searchbox-input" onkeyup="buttonUp();">

          </div>
          </div>
          <div class="actions">
          <button type="submit" class="action search searchbox-submit" >
          <span>Go</span>
          </button>

          <span class="searchbox-icon">Find</span>

          </div>
          </form>


          As your required for mobile only so add css in mobile media query that is below 768px



          .searchbox{
          position:relative;
          min-width:50px;
          width:0%;
          height:50px;
          float:right;
          overflow:hidden;

          -webkit-transition: width 0.3s;
          -moz-transition: width 0.3s;
          -ms-transition: width 0.3s;
          -o-transition: width 0.3s;
          transition: width 0.3s;
          }

          .searchbox-input{
          top:0;
          right:0;
          border:0;
          outline:0;
          background:#dcddd8;
          width:100%;
          height:50px;
          margin:0;
          padding:0px 55px 0px 20px;
          font-size:20px;
          color:red;
          }


          .searchbox-input::-webkit-input-placeholder {
          color: #d74b4b;
          }
          .searchbox-input:-moz-placeholder {
          color: #d74b4b;
          }
          .searchbox-input::-moz-placeholder {
          color: #d74b4b;
          }
          .searchbox-input:-ms-input-placeholder {
          color: #d74b4b;
          }


          .searchbox-icon,
          .searchbox-submit{
          width:50px;
          height:50px;
          display:block;
          position:absolute;
          top:0;
          font-family:verdana;
          font-size:22px;
          right:0;
          padding:0;
          margin:0;
          border:0;
          outline:0;
          line-height:50px;
          text-align:center;
          cursor:pointer;
          color:#dcddd8;
          background:#172b3c;
          }



          .searchbox-open{
          width:100%;
          }

          .label {
          border: 0;
          clip: rect(0, 0, 0, 0);
          height: 1px;
          margin: -1px;
          overflow: hidden;
          padding: 0;
          position: absolute;
          width: 1px;
          }


          As your required for mobile only so trigger js in mobile below 768px only



            $(document).ready(function(){
          var submitIcon = $('.searchbox-icon');
          var inputBox = $('.searchbox-input');
          var searchBox = $('.searchbox');
          var isOpen = false;
          submitIcon.click(function(){
          if(isOpen == false){
          searchBox.addClass('searchbox-open');
          inputBox.focus();
          isOpen = true;
          } else {
          searchBox.removeClass('searchbox-open');
          inputBox.focusout();
          isOpen = false;
          }
          });
          submitIcon.mouseup(function(){
          return false;
          });
          searchBox.mouseup(function(){
          return false;
          });
          $(document).mouseup(function(){
          if(isOpen == true){
          $('.searchbox-icon').css('display','block');
          submitIcon.click();
          }
          });
          });
          function buttonUp(){
          var inputVal = $('.searchbox-input').val();
          inputVal = $.trim(inputVal).length;
          if( inputVal !== 0){
          $('.searchbox-icon').css('display','none');
          } else {
          $('.searchbox-input').val('');
          $('.searchbox-icon').css('display','block');
          }
          }


          Note : It just an example to achieve your output, update css and js per your need.






          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%2f204277%2fhow-to-change-a-search-input-box-into-a-search-icon-as-in-mobile-view%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Example: Default magento search form : only required part shown in example, in phtml only update the attribute of elements



            Form Element add extra class = searchbox



            Form Input search box add extra class = searchbox-input & onkeyup=buttonUp()



            Form Submit button extra class = searchbox-submit



            And Next to submit button add a span element



            <span class="searchbox-icon">Find</span>



            <form class="form minisearch searchbox" id="search_mini_form" ...>
            <div class="field search">
            <label class="label" ... >
            <span>Search</span>
            </label>
            <div class="control">
            <input id="search" type="text" ... class="input-text searchbox-input" onkeyup="buttonUp();">

            </div>
            </div>
            <div class="actions">
            <button type="submit" class="action search searchbox-submit" >
            <span>Go</span>
            </button>

            <span class="searchbox-icon">Find</span>

            </div>
            </form>


            As your required for mobile only so add css in mobile media query that is below 768px



            .searchbox{
            position:relative;
            min-width:50px;
            width:0%;
            height:50px;
            float:right;
            overflow:hidden;

            -webkit-transition: width 0.3s;
            -moz-transition: width 0.3s;
            -ms-transition: width 0.3s;
            -o-transition: width 0.3s;
            transition: width 0.3s;
            }

            .searchbox-input{
            top:0;
            right:0;
            border:0;
            outline:0;
            background:#dcddd8;
            width:100%;
            height:50px;
            margin:0;
            padding:0px 55px 0px 20px;
            font-size:20px;
            color:red;
            }


            .searchbox-input::-webkit-input-placeholder {
            color: #d74b4b;
            }
            .searchbox-input:-moz-placeholder {
            color: #d74b4b;
            }
            .searchbox-input::-moz-placeholder {
            color: #d74b4b;
            }
            .searchbox-input:-ms-input-placeholder {
            color: #d74b4b;
            }


            .searchbox-icon,
            .searchbox-submit{
            width:50px;
            height:50px;
            display:block;
            position:absolute;
            top:0;
            font-family:verdana;
            font-size:22px;
            right:0;
            padding:0;
            margin:0;
            border:0;
            outline:0;
            line-height:50px;
            text-align:center;
            cursor:pointer;
            color:#dcddd8;
            background:#172b3c;
            }



            .searchbox-open{
            width:100%;
            }

            .label {
            border: 0;
            clip: rect(0, 0, 0, 0);
            height: 1px;
            margin: -1px;
            overflow: hidden;
            padding: 0;
            position: absolute;
            width: 1px;
            }


            As your required for mobile only so trigger js in mobile below 768px only



              $(document).ready(function(){
            var submitIcon = $('.searchbox-icon');
            var inputBox = $('.searchbox-input');
            var searchBox = $('.searchbox');
            var isOpen = false;
            submitIcon.click(function(){
            if(isOpen == false){
            searchBox.addClass('searchbox-open');
            inputBox.focus();
            isOpen = true;
            } else {
            searchBox.removeClass('searchbox-open');
            inputBox.focusout();
            isOpen = false;
            }
            });
            submitIcon.mouseup(function(){
            return false;
            });
            searchBox.mouseup(function(){
            return false;
            });
            $(document).mouseup(function(){
            if(isOpen == true){
            $('.searchbox-icon').css('display','block');
            submitIcon.click();
            }
            });
            });
            function buttonUp(){
            var inputVal = $('.searchbox-input').val();
            inputVal = $.trim(inputVal).length;
            if( inputVal !== 0){
            $('.searchbox-icon').css('display','none');
            } else {
            $('.searchbox-input').val('');
            $('.searchbox-icon').css('display','block');
            }
            }


            Note : It just an example to achieve your output, update css and js per your need.






            share|improve this answer




























              0














              Example: Default magento search form : only required part shown in example, in phtml only update the attribute of elements



              Form Element add extra class = searchbox



              Form Input search box add extra class = searchbox-input & onkeyup=buttonUp()



              Form Submit button extra class = searchbox-submit



              And Next to submit button add a span element



              <span class="searchbox-icon">Find</span>



              <form class="form minisearch searchbox" id="search_mini_form" ...>
              <div class="field search">
              <label class="label" ... >
              <span>Search</span>
              </label>
              <div class="control">
              <input id="search" type="text" ... class="input-text searchbox-input" onkeyup="buttonUp();">

              </div>
              </div>
              <div class="actions">
              <button type="submit" class="action search searchbox-submit" >
              <span>Go</span>
              </button>

              <span class="searchbox-icon">Find</span>

              </div>
              </form>


              As your required for mobile only so add css in mobile media query that is below 768px



              .searchbox{
              position:relative;
              min-width:50px;
              width:0%;
              height:50px;
              float:right;
              overflow:hidden;

              -webkit-transition: width 0.3s;
              -moz-transition: width 0.3s;
              -ms-transition: width 0.3s;
              -o-transition: width 0.3s;
              transition: width 0.3s;
              }

              .searchbox-input{
              top:0;
              right:0;
              border:0;
              outline:0;
              background:#dcddd8;
              width:100%;
              height:50px;
              margin:0;
              padding:0px 55px 0px 20px;
              font-size:20px;
              color:red;
              }


              .searchbox-input::-webkit-input-placeholder {
              color: #d74b4b;
              }
              .searchbox-input:-moz-placeholder {
              color: #d74b4b;
              }
              .searchbox-input::-moz-placeholder {
              color: #d74b4b;
              }
              .searchbox-input:-ms-input-placeholder {
              color: #d74b4b;
              }


              .searchbox-icon,
              .searchbox-submit{
              width:50px;
              height:50px;
              display:block;
              position:absolute;
              top:0;
              font-family:verdana;
              font-size:22px;
              right:0;
              padding:0;
              margin:0;
              border:0;
              outline:0;
              line-height:50px;
              text-align:center;
              cursor:pointer;
              color:#dcddd8;
              background:#172b3c;
              }



              .searchbox-open{
              width:100%;
              }

              .label {
              border: 0;
              clip: rect(0, 0, 0, 0);
              height: 1px;
              margin: -1px;
              overflow: hidden;
              padding: 0;
              position: absolute;
              width: 1px;
              }


              As your required for mobile only so trigger js in mobile below 768px only



                $(document).ready(function(){
              var submitIcon = $('.searchbox-icon');
              var inputBox = $('.searchbox-input');
              var searchBox = $('.searchbox');
              var isOpen = false;
              submitIcon.click(function(){
              if(isOpen == false){
              searchBox.addClass('searchbox-open');
              inputBox.focus();
              isOpen = true;
              } else {
              searchBox.removeClass('searchbox-open');
              inputBox.focusout();
              isOpen = false;
              }
              });
              submitIcon.mouseup(function(){
              return false;
              });
              searchBox.mouseup(function(){
              return false;
              });
              $(document).mouseup(function(){
              if(isOpen == true){
              $('.searchbox-icon').css('display','block');
              submitIcon.click();
              }
              });
              });
              function buttonUp(){
              var inputVal = $('.searchbox-input').val();
              inputVal = $.trim(inputVal).length;
              if( inputVal !== 0){
              $('.searchbox-icon').css('display','none');
              } else {
              $('.searchbox-input').val('');
              $('.searchbox-icon').css('display','block');
              }
              }


              Note : It just an example to achieve your output, update css and js per your need.






              share|improve this answer


























                0












                0








                0







                Example: Default magento search form : only required part shown in example, in phtml only update the attribute of elements



                Form Element add extra class = searchbox



                Form Input search box add extra class = searchbox-input & onkeyup=buttonUp()



                Form Submit button extra class = searchbox-submit



                And Next to submit button add a span element



                <span class="searchbox-icon">Find</span>



                <form class="form minisearch searchbox" id="search_mini_form" ...>
                <div class="field search">
                <label class="label" ... >
                <span>Search</span>
                </label>
                <div class="control">
                <input id="search" type="text" ... class="input-text searchbox-input" onkeyup="buttonUp();">

                </div>
                </div>
                <div class="actions">
                <button type="submit" class="action search searchbox-submit" >
                <span>Go</span>
                </button>

                <span class="searchbox-icon">Find</span>

                </div>
                </form>


                As your required for mobile only so add css in mobile media query that is below 768px



                .searchbox{
                position:relative;
                min-width:50px;
                width:0%;
                height:50px;
                float:right;
                overflow:hidden;

                -webkit-transition: width 0.3s;
                -moz-transition: width 0.3s;
                -ms-transition: width 0.3s;
                -o-transition: width 0.3s;
                transition: width 0.3s;
                }

                .searchbox-input{
                top:0;
                right:0;
                border:0;
                outline:0;
                background:#dcddd8;
                width:100%;
                height:50px;
                margin:0;
                padding:0px 55px 0px 20px;
                font-size:20px;
                color:red;
                }


                .searchbox-input::-webkit-input-placeholder {
                color: #d74b4b;
                }
                .searchbox-input:-moz-placeholder {
                color: #d74b4b;
                }
                .searchbox-input::-moz-placeholder {
                color: #d74b4b;
                }
                .searchbox-input:-ms-input-placeholder {
                color: #d74b4b;
                }


                .searchbox-icon,
                .searchbox-submit{
                width:50px;
                height:50px;
                display:block;
                position:absolute;
                top:0;
                font-family:verdana;
                font-size:22px;
                right:0;
                padding:0;
                margin:0;
                border:0;
                outline:0;
                line-height:50px;
                text-align:center;
                cursor:pointer;
                color:#dcddd8;
                background:#172b3c;
                }



                .searchbox-open{
                width:100%;
                }

                .label {
                border: 0;
                clip: rect(0, 0, 0, 0);
                height: 1px;
                margin: -1px;
                overflow: hidden;
                padding: 0;
                position: absolute;
                width: 1px;
                }


                As your required for mobile only so trigger js in mobile below 768px only



                  $(document).ready(function(){
                var submitIcon = $('.searchbox-icon');
                var inputBox = $('.searchbox-input');
                var searchBox = $('.searchbox');
                var isOpen = false;
                submitIcon.click(function(){
                if(isOpen == false){
                searchBox.addClass('searchbox-open');
                inputBox.focus();
                isOpen = true;
                } else {
                searchBox.removeClass('searchbox-open');
                inputBox.focusout();
                isOpen = false;
                }
                });
                submitIcon.mouseup(function(){
                return false;
                });
                searchBox.mouseup(function(){
                return false;
                });
                $(document).mouseup(function(){
                if(isOpen == true){
                $('.searchbox-icon').css('display','block');
                submitIcon.click();
                }
                });
                });
                function buttonUp(){
                var inputVal = $('.searchbox-input').val();
                inputVal = $.trim(inputVal).length;
                if( inputVal !== 0){
                $('.searchbox-icon').css('display','none');
                } else {
                $('.searchbox-input').val('');
                $('.searchbox-icon').css('display','block');
                }
                }


                Note : It just an example to achieve your output, update css and js per your need.






                share|improve this answer













                Example: Default magento search form : only required part shown in example, in phtml only update the attribute of elements



                Form Element add extra class = searchbox



                Form Input search box add extra class = searchbox-input & onkeyup=buttonUp()



                Form Submit button extra class = searchbox-submit



                And Next to submit button add a span element



                <span class="searchbox-icon">Find</span>



                <form class="form minisearch searchbox" id="search_mini_form" ...>
                <div class="field search">
                <label class="label" ... >
                <span>Search</span>
                </label>
                <div class="control">
                <input id="search" type="text" ... class="input-text searchbox-input" onkeyup="buttonUp();">

                </div>
                </div>
                <div class="actions">
                <button type="submit" class="action search searchbox-submit" >
                <span>Go</span>
                </button>

                <span class="searchbox-icon">Find</span>

                </div>
                </form>


                As your required for mobile only so add css in mobile media query that is below 768px



                .searchbox{
                position:relative;
                min-width:50px;
                width:0%;
                height:50px;
                float:right;
                overflow:hidden;

                -webkit-transition: width 0.3s;
                -moz-transition: width 0.3s;
                -ms-transition: width 0.3s;
                -o-transition: width 0.3s;
                transition: width 0.3s;
                }

                .searchbox-input{
                top:0;
                right:0;
                border:0;
                outline:0;
                background:#dcddd8;
                width:100%;
                height:50px;
                margin:0;
                padding:0px 55px 0px 20px;
                font-size:20px;
                color:red;
                }


                .searchbox-input::-webkit-input-placeholder {
                color: #d74b4b;
                }
                .searchbox-input:-moz-placeholder {
                color: #d74b4b;
                }
                .searchbox-input::-moz-placeholder {
                color: #d74b4b;
                }
                .searchbox-input:-ms-input-placeholder {
                color: #d74b4b;
                }


                .searchbox-icon,
                .searchbox-submit{
                width:50px;
                height:50px;
                display:block;
                position:absolute;
                top:0;
                font-family:verdana;
                font-size:22px;
                right:0;
                padding:0;
                margin:0;
                border:0;
                outline:0;
                line-height:50px;
                text-align:center;
                cursor:pointer;
                color:#dcddd8;
                background:#172b3c;
                }



                .searchbox-open{
                width:100%;
                }

                .label {
                border: 0;
                clip: rect(0, 0, 0, 0);
                height: 1px;
                margin: -1px;
                overflow: hidden;
                padding: 0;
                position: absolute;
                width: 1px;
                }


                As your required for mobile only so trigger js in mobile below 768px only



                  $(document).ready(function(){
                var submitIcon = $('.searchbox-icon');
                var inputBox = $('.searchbox-input');
                var searchBox = $('.searchbox');
                var isOpen = false;
                submitIcon.click(function(){
                if(isOpen == false){
                searchBox.addClass('searchbox-open');
                inputBox.focus();
                isOpen = true;
                } else {
                searchBox.removeClass('searchbox-open');
                inputBox.focusout();
                isOpen = false;
                }
                });
                submitIcon.mouseup(function(){
                return false;
                });
                searchBox.mouseup(function(){
                return false;
                });
                $(document).mouseup(function(){
                if(isOpen == true){
                $('.searchbox-icon').css('display','block');
                submitIcon.click();
                }
                });
                });
                function buttonUp(){
                var inputVal = $('.searchbox-input').val();
                inputVal = $.trim(inputVal).length;
                if( inputVal !== 0){
                $('.searchbox-icon').css('display','none');
                } else {
                $('.searchbox-input').val('');
                $('.searchbox-icon').css('display','block');
                }
                }


                Note : It just an example to achieve your output, update css and js per your need.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 31 '18 at 23:06









                Kanhaiya lalKanhaiya lal

                880317




                880317






























                    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%2f204277%2fhow-to-change-a-search-input-box-into-a-search-icon-as-in-mobile-view%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

                    “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                    How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                    夢乃愛華...