A
A
Artyom Albe2018-06-08 12:08:30
JavaScript
Artyom Albe, 2018-06-08 12:08:30

After adding the mouseup event, the toggle function stopped working. Why?

The .filter__list block no longer disappears when the button is clicked

$(document).mouseup(function (e){ 
      var div = $(".filter .item .filter__list"); 
      
      if (!div.is(e.target) && div.has(e.target).length === 0) { 
        	div.css('display', 'none');
      } 
    
    	
    });

   $('.filter .item:nth-child(1) button').click(function() {
    	$('.filter .item:nth-child(1) .filter__list ').toggle();
   });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question