jquery plugin on click check element is visible
Hi,
I'm creating a plugin that opens a popup/tooltip on click a Icon.
The problem i'm having is that on click i want to check if the element is visible or hidden.
If visible close the tooltip else if hidden open the tool tip.
What the issue is that the .is(':visible') always returns false even though the element is visible and i can't work out why.
A code review would be good to. I have create a jsFiddle link so you can try it out.
This is the code that i have to do the visibility check.
- link.click(function(){
- console.log(content_wrapper.is(':visible'));
- if(content_wrapper.is(':visible')){
- methods.hide.call(main_wrapper);
- }else{
- methods.show.call(main_wrapper);
- }
- return false;
- });