Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1214726
    2342J
    Participant

    Hmm.

    #1215023
    Rupok
    Member

    If you still face any issue feel free to let us know. We’ll be happy to assist you.

    #1279004
    2342J
    Participant

    This worked for me. Thank you. Now I notice that when you click on the search it opens and works, but you can’t cancel/close it by clicking on the screen again.

    #1279130
    2342J
    Participant

    Can you take a look at this java script again? It does not cancel the search on keydown.

    jQuery(function($) {
    
      var $trigger  = $('.x-btn-navbar-search');
      var $formWrap = $('.x-searchform-overlay');
      var $input    = $formWrap.find('.search-query');
      var escKey    = 27;
    
      function clearSearch() {
        $formWrap.toggleClass('in');
        setTimeout(function() { $input.val(''); }, 350);
      }
    
      $trigger.on('touchstart click', function(e) {
        e.preventDefault();
        $formWrap.toggleClass('in');
        $input.focus();
      });
    
      $formWrap.on('touchstart click', function(e) {
        if ( ! $(e.target).hasClass('search-query') ) {
          clearSearch();
        }
      });
    
      $(document).keydown(function(e) {
        if ( e.which === escKey ) {
          if ( $formWrap.hasClass('in') ) {
            clearSearch();
          }
        }
      });
    
    });
    #1279319
    Rue Nel
    Moderator

    Hello There,

    We have tried to login to your site to fix the issue. Regretfully the given access is no longer working for us. Regrading the JS code, the esc key works perfectly when we tested your site. It’s just that the search overlay doesn’t exit when you click anywhere outside the search input. Could you please give us access to your site again so that we can fix the issue. If you have installed WordFence, please temporarily disable it for the time being.

    Thank you.

    #1280214
    2342J
    Participant
    This reply has been marked as private.
    #1280323
    Rue Nel
    Moderator

    Hello There,

    To resolve your issue, please update the JS code and use this instead:

    jQuery(function($) {
    
      var $trigger  = $('.x-btn-navbar-search');
      var $formWrap = $('.x-searchform-overlay');
      var $input    = $formWrap.find('.search-query');
      var escKey    = 27;
    
      function clearSearch() {
        $formWrap.toggleClass('in');
        setTimeout(function() { $input.val(''); }, 350);
      }
    
      $trigger.on('touchstart click', function(e) {
        e.preventDefault();
        $formWrap.toggleClass('in');
        $input.focus();
      });
    
      $(document).keydown(function(e) {
        if ( e.which === escKey ) {
          if ( $formWrap.hasClass('in') ) {
            clearSearch();
          }
        }
      });
    
    });

    We would loved to know if this has work for you. Thank you.

    #1280519
    2342J
    Participant

    Yes! Well done. Thanks for that, I’m learning a lot from you.

    #1280532
    Thai
    Moderator

    If you need anything else please let us know.

    #1297308
    2342J
    Participant

    Resolved. Thanks again!

    #1297453
    Rue Nel
    Moderator

    You’re welcome! We’re happy to help you out.
    If you need anything else we can help you with, don’t hesitate to open another thread.

  • <script> jQuery(function($){ $("#no-reply-1203411 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>