jquery plugin on click check element is visible

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.

  1. link.click(function(){
  2. console.log(content_wrapper.is(':visible'));
  3. if(content_wrapper.is(':visible')){
  4. methods.hide.call(main_wrapper);
  5. }else{
  6. methods.show.call(main_wrapper);
  7. }
  8. return false;
  9. });