Event listener for when element becomes visible?

后端 未结 9 2141
感情败类
感情败类 2020-11-28 05:36

I am building a toolbar that is going to be included into a page. the div it is going to be included in will default to display:none. Is there a way i can p

9条回答
  •  情书的邮戳
    2020-11-28 06:13

    I had this same problem and created a jQuery plugin to solve it for our site.

    https://github.com/shaunbowe/jquery.visibilityChanged

    Here is how you would use it based on your example:

    $('#contentDiv').visibilityChanged(function(element, visible) {
        alert("do something");
    });
    

提交回复
热议问题