Co-authored-by: widlam <mikolaj.widla@gmail.com> Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: #184 Reviewed-by: Adam Bem <bema@noreply.example.com> Co-authored-by: Mikolaj Widla <widlam@noreply.example.com> Co-committed-by: Mikolaj Widla <widlam@noreply.example.com>
		
			
				
	
	
		
			34 lines
		
	
	
		
			864 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			864 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
 | |
| function switchPopups (neededPopupOption) { 
 | |
|     $('.hiddable-popup-option').addClass('hidden-popup-type');
 | |
|     $('#'+neededPopupOption).removeClass('hidden-popup-type');
 | |
|  }
 | |
| 
 | |
| function showPopup(){
 | |
|     $('.popup-flex').removeClass('hiddable-container');
 | |
| }
 | |
| 
 | |
| function hidePopup(){
 | |
|     $('.popup-flex').addClass('hiddable-container');
 | |
|     $('.hiddable-popup-option').addClass('hidden-popup-type');
 | |
| }
 | |
| 
 | |
| /*
 | |
| * Event listener that's close the popup when user clicks out of a popup.
 | |
| */
 | |
| 
 | |
| window.addEventListener(
 | |
|     'click' ,
 | |
|     (clickedElement) => {
 | |
|         if(!document.getElementById('popup-body').contains(clickedElement.target) && clickedElement.target.className == 'popup-flex' ) {
 | |
|             hidePopup();
 | |
|         }
 | |
|     }
 | |
| );
 | |
| 
 | |
| $('.popup-button-close').click(
 | |
|     () => {
 | |
|         hidePopup();
 | |
|         $('.hiddable-popup-option').addClass('hidden-popup-type')
 | |
|     }
 | |
| ); |