Codeinwp / carouFredSel-jQuery

A circular, responsive carousel plugin built using the jQuery.
http://caroufredsel.dev7studios.com
Other
318 stars 476 forks source link

Question about ms_getParentSize() #22

Open zdfs opened 10 years ago

zdfs commented 10 years ago

I'm looking at ms_getParentSize() function:

function ms_getParentSize($w, o, d) {
  var isVisible = $w.is(':visible');
  if (isVisible) { $w.hide(); }
  var s = $w.parent()[o.d[d]]();
  if (isVisible) { $w.show(); }
  return s;
}

I don't understand the need for the whole isVisible thing. Seems like what you're returning isn't dependent on showing and hiding the window object. I feel like I'm missing something, but removing the code doesn't seem to have any adverse effects (it also solves a bug when using the carousel with the Zurb Foundation framework).

Edit: The $w arg is actually the caroufredsel instance (which makes more sense), but still not sure why we need to hide it and show it again.

So I thought I'd ask about it before I do something potentially stupid.