jquery-match-height icon indicating copy to clipboard operation
jquery-match-height copied to clipboard

Recalculate based on click event

Open netfuelltd opened this issue 8 years ago • 6 comments

Is it possible to recalculate the height(s) based on a click event? We're using ul tabs and one of the tabs is quite long so it overflows into the div below.

If I could add a click event JS when the tab is clicked/change to recalculate would be fantastic.

What a great thing matchHeight is by the way! I love it!

Kind regards Liam

netfuelltd avatar Apr 25 '17 08:04 netfuelltd

See the readme on Manually triggering an update.

liabru avatar Apr 25 '17 09:04 liabru

I've tried what was provided but I don't seem to be able to get it to work.

I use the following which works perfectly for setting on page load: jQuery(document).ready(function(){ jQuery(function() { jQuery('.match_height').matchHeight(); });
});

We have tried a few different ways of recalculating from the documentation but nothing seems to work. Any chance you can provide me with the line to use based on the following?

jQuery( ".x-nav-tabs li" ).click(function() { // update JS goes here });

Kind regards Liam

netfuelltd avatar May 30 '17 16:05 netfuelltd

$.fn.matchHeight._update()

liabru avatar May 31 '17 23:05 liabru

@netfuelltd have you made it work? i have a similar problem too but in my case its accordion @liabru when the accordion open it extends and it should be still same height with other parent divs

cloudemp04 avatar Aug 15 '18 12:08 cloudemp04

I am not able to make it work either. Any tips?

ghost avatar Mar 28 '19 21:03 ghost

I am having a similar issue, when I call $.fn.matchHeight._apply(myElements); via a jQuery click event, it does not work - but if I click the link a second time, it does work. Any idea why? My code:

var filteredItems = $('.item').find('.filtered-class');

$('ul.filter-menu li').bind('click', function(e) {
       $.fn.matchHeight._apply(filteredItems);
});

ghost avatar May 31 '19 01:05 ghost