I have a snippet of code here which I plan on using to detect which sections are already visible to aid in a navigation system I am working on however when I try to grab the visibility attribute I am unable to get a return. Any help is greatly appreciated.
if(method === 'test'){
console.log('Test Function Firing')
var testvar = $('div#home').attr("visibility");
if(testvar === 'visible'){
console.log('Working')
}
else{console.log('Not Working')
console.log(testvar);
console.log("Log of call to "+$('div#home').attr("visibility"));
}
}
visibilityisn’t an attribute, its a CSS property.Use
.css()instead: