search input issue

This topic contains 5 replies, has 2 voices, and was last updated by

 
Keymaster
2 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21078

    Participant

    Hi,
    in the menu there is currently a magnifying glass as icon, if you click on it, the input field opens. But in order to enter something into the search field, I have to click into the input field and then I can write.
    However, I want the input field to open after clicking on the icon and I can write directly into the input field without clicking again.
    Is there a way to do this?
    Best regards

    #21079

    Hi,

    I believe the only option there is to use a custom code, since the plugin is integrated into a custom container.
    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_action('wp_footer', 'asp_focus_on_menu_click');
    function asp_focus_on_menu_click() {
      ?>
      <script>
      jQuery(function($){
        $('li.fusion-main-menu-search a').on('click', function(){
          $('.fusion-custom-menu-item-contents .asp_m input.orig').get(0).focus();
        });
      });
      </script>
      <?php
    }

    This should force the input focus, once the magnifier icon is clicked.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #21160

    Participant
    You cannot access this content.
    #21170
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #21285

    Participant
    You cannot access this content.
    #21290

    Hi,

    Thank you! For some reason it only works if I add some delay to the focus script. The final code is then:

    add_action('wp_footer', 'asp_focus_on_menu_click');
    function asp_focus_on_menu_click() {
      ?>
      <script>
      jQuery(function($){
        $('li.fusion-main-menu-search').on('mouseup touchend', function(){
    	  setTimeout(function() { jQuery('.fusion-custom-menu-item-contents .asp_m input.orig').get(0).focus();}, 240);
        });
      });
      </script>
      <?php
    }

    Once you clear your site and browser cache, it should start working.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.