detect when element is visible code example
Example 1: check if element is visible
.is(':visible')
//Selects all elements that are visible.
if($('#Div').is(':visible')){
// add whatever code you want to run here.
}
$('#yourDiv:visible').callYourFunction();
Example 2: to check element visible
if(driver.findElement(By.cssSelector("a > font")).isDisplayed())
{ System.out.println("Element is Visible");
}else{ System.out.println("Element is InVisible"); }