Jquery checks if element is hidden (continuously)

How to check if an item was hidden right away. for example, how to notify the visibility of an element.

In my case, the element is hidden using a function slideUp. Immediately I should be notified of the visibility of this element.

I had an idea to use a method bind(). But he has no event onHide. So how to do this? Any suggestions would be helpful!

EDIT:

I know what can be used is(':hidden'), but I want to constantly check howaddEventListener

+3
source share
2 answers
if($('#selector').is(':visible')){
   //is visible
}else{
  //is NOT visible threfore is hidden
}

/

if($('#selector').css('opacity')!=0){
       //is visible//or partially visible//depends on opacity
    }else{
      //is NOT visible threfore is hidden
    }

, -

2

function checkVisibility(){
   //put the visibility checker here
   setTimeout('checkVisibility',1000)//every 1 second...
}

: , ,

+7

slideUp, , :

function theElementIsHidden()
{
    //What to do when the slideUp animation (element hidden) is completed...
}

$("#element").slideUp(200, function(){theElementIsHidden();}
0

Source: https://habr.com/ru/post/1756438/


All Articles