Git Product home page Git Product logo

Comments (9)

liabru avatar liabru commented on May 18, 2024

If I use plugin in basic way: $('.block').matchHeight('.row-blocks'); everything works well, but window freezes/lags during resizing.

Can you confirm this gives the correct result?
If that does work, I think the real problem here is the freeze / lag during resizing?

If this is the case, I can add an option to limit the update rate to prevent this.

from jquery-match-height.

chudy91 avatar chudy91 commented on May 18, 2024

Thanks for reply. :)
There is problem with $('.block').matchHeight('.row-blocks'); in some case, but I didn't mention this before because I'm not sure if this is a fault of your plugin.
In some places there are responsive tabs (https://github.com/petelove666/Responsive-Tabs), which contain responsive carousels (http://www.owlgraphic.com/owlcarousel/) with equal height blocks (graphic designer had a lot of fun designing it :/). When page is launched first time (not cached), somethimes when tab is closed and then is opened, blocks have height 0px (maybe because they have property display: none?). But when I resize window, script works for this tab and divs has equal height but always - the rest of blocks in hidden tabs has no height again. If I use script with 'apply' and 'update' methods, there is no problem (except switching desktop/mobile view and vice versa what I've posted above). I handle tabs issue this way that on each click tab event 'update' method is called and everything looks OK.

Anyway, limit update rate could be a nice feature. :)

$(window).load(function () {
// other stuff
$('.block').matchHeight('.row-blocks');
RESPONSIVEUI.responsiveTabs();

$('.responsive-tabs li, .responsive-tabs h2').click(function () { 
    $.fn.matchHeight._update();
});

});

from jquery-match-height.

liabru avatar liabru commented on May 18, 2024

You need to apply matchHeight before you apply anything else like tabs that may hide your content because the height will become 0. matchHeight can't work on content that is hidden.

Then if things are changing size dynamically that's not based on resize event, you then need to manually call $.fn.matchHeight._update after the change (you may also need to temporarily disable the hiding that the tabs plugin is using and apply it after update).

I'll look into doing an option to limit the rate

from jquery-match-height.

chudy91 avatar chudy91 commented on May 18, 2024

OK, thanks for advice. I'll figure sth out.

from jquery-match-height.

liabru avatar liabru commented on May 18, 2024

I've added a throttle method in 6d9a6a7

Can you grab a copy of the latest build and confirm if this solves your issue so I can close this?

You can change the throttle like so:

$.fn.matchHeight._throttle = 80;

By default, the _update method is throttled to execute at a maximum rate of once every 80ms.
Decreasing the above _throttle property will update your layout quicker, appearing smoother during resize, at the expense of performance.
If you experience lagging or freezing during resize, you should increase the _throttle property.

from jquery-match-height.

chudy91 avatar chudy91 commented on May 18, 2024

Sure, I'll test it tomorrow at work :) . I've decided to use your script only with $('.block').matchHeight('.row-blocks'); because it works well for all blocks. Does $.fn.matchHeight._throttle = 80; work with .matchHeight() too or only with _update method?

from jquery-match-height.

liabru avatar liabru commented on May 18, 2024

Yep, the throttle is on by default now when using $.matchHeight()

from jquery-match-height.

chudy91 avatar chudy91 commented on May 18, 2024

Windows resize much faster. Thank you for your plugin and support :) .

from jquery-match-height.

liabru avatar liabru commented on May 18, 2024

Awesome, thanks

from jquery-match-height.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.