• Resolved tcempk

    (@tcempk)


    Hey!

    As it is the search bar (toggle expand) opens when you click on the fa search icon and closes when you do the same. I want it to close when you click whenrever else on the site. I know it’s a jQuery in script.js but I can’t seem to be able to get the code right.

    As it is the code is

    `$(‘.toggle-search’).click(function(){
    $(‘.toggle-search’).toggleClass(‘active’);
    $(‘.search-expand’).fadeToggle(250);
    setTimeout(function(){
    $(‘.search-expand input’).focus();
    }, 300);
    });`

Viewing 1 replies (of 1 total)
  • Thread Starter tcempk

    (@tcempk)

    If anyone ever needs a simmilar thing

    $('.toggle-search').click(function(e){ // <----you missed the '.' here in your selector.
              e.stopPropagation();
    		  $('.toggle-search').toggleClass('active');
              $('.search-expand').fadeToggle(250);
    setTimeout(function(){
    	$('.search-expand input').focus();
    	}, 300);		  
    
          });
          $('.search-expand').click(function(e){
              e.stopPropagation();
          });
    
          $(document).click(function(){
              $('.search-expand').fadeOut(250);
    		  $('.toggle-search').removeClass('active');
          });
    
    	$('.toggle-search2').click(function(){
              $('.search-expand').fadeOut(250);
    		  $('.toggle-search').removeClass('active');
          });
Viewing 1 replies (of 1 total)
  • The topic ‘toggle search deactivate’ is closed to new replies.