Skip to content

Commit

Permalink
Make Equalizer only calculate for visible elements
Browse files Browse the repository at this point in the history
  • Loading branch information
thedeerchild committed Apr 2, 2014
1 parent fb1e37b commit d4f2147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/foundation/foundation.equalizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

equalize: function(equalizer) {
var isStacked = false,
vals = equalizer.find('[' + this.attr_name() + '-watch]'),
vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
firstTopOffset = vals.first().offset().top,
settings = equalizer.data(this.attr_name(true)+'-init');

Expand Down

3 comments on commit d4f2147

@oller
Copy link
Contributor

@oller oller commented on d4f2147 Apr 3, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may need a little more work, as it stands when none are visible, vals returns undefined, line 30 then errors:
Uncaught TypeError: Cannot read property 'top' of undefined

Imagine it needs to be wrapped in if (vals.length > 0) or it may be wiser to apply the :visible selector to the data-equalizer attribute in the triggering reflow function further down?

@jeffclemens
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thedeerchild , what was the purpose of this change? One of it's side effects is that Equalizer is no longer compatible out-of-the-box with plugins that temporarily hide elements such as Tabs. Details and code examples can be found here:

#5422

@jonathanmelville
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anyone answer what the purpose of this change was? It breaks thinks like trying to include Equalizer in a Reveal modal. The transition is jerky and jarring instead of being smooth because equalizer can't act on the content until it becomes visible.

Please sign in to comment.