This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

search input issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21078
    medienvirusmedienvirus
    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
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

    #21160
    medienvirusmedienvirus
    Participant

    You cannot access this content.

    #21170
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    #21285
    medienvirusmedienvirus
    Participant

    You cannot access this content.

    #21290
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.