Run a check every 1 second. If the #element
exists and is visible then clear(stop) the interval and execute your code.
var checkVisible = setInterval(function(){
// if element doesn't exist or isn't visible then end
if(!$('#element').length || !$('#element').is(':visible'))
return;
// if element does exist and is visible then stop the interval and run code
clearInterval(checkVisible);
// place your code here to run when the element becomes visible
},1000);
Inevitably you have some jQuery event callback which shows the element; in those event callbacks you should place your 'when element is visible' run code.