syncheight-mp

jQuery Sync Heights Plugin (FORK) ===========================

Usage no npm install needed!

<script type="module">
  import syncheightMp from 'https://cdn.skypack.dev/syncheight-mp';
</script>

README

jQuery Sync Heights Plugin (FORK)

This is a fork of https://github.com/ginader/syncHeight.

Changes:

  • Add 1px to max height. This solves a problem with firefox
  • moved jquery file to dev-dependencies
  • published it to npm as syncheight-mp and optimized package.json

jQuery Plugin that automatically syncs the height properties of the elements that match the given selector.

Usage:

// use $(window).load instead of $(document).ready to wait until all images have been loaded.
// Otherwise common height may be calculated without taking all images into account
$(window).load(function(){
    $('p').syncHeight({ 'updateOnResize': true});
});
// and to undo the syncing again run (here when the window is smaller than 500px): 
$(window).resize(function(){
    if($(window).width() < 500){
        $('p').unSyncHeight();
    }
});

Parameters:

height (default: false): set a static number in pixel (e.g. 250) to prevent from automatically figuring out the common height and using the given number.

updateOnResize (default: false): automatically sync elements if browser window gets resized

See also