From 1e991a06e4664f7b2af15821a45ba05e082d74aa Mon Sep 17 00:00:00 2001 From: JM Addington Date: Wed, 5 Nov 2014 11:58:44 -0500 Subject: [PATCH] To get the plugin the reliably resize I had to change the initialization. --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 38997ba..e3f0669 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,26 @@ 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}); + if($(window).width() > 500){ + $('.columns1').syncHeight({ 'updateOnResize': true}); + } }); - // and to undo the syncing again run (here when the window is smaller than 500px): - $(window).resize(function(){ + // and to undo the syncing again run (here when the window is smaller than 500px): + + var resize = function(){ if($(window).width() < 500){ - $('p').unSyncHeight(); + $('.columns1').each(function() { + $(this).css('height', 'auto'); + $(this).css('min-height', ''); + }); + } else { + $('.columns1').syncHeight(); } + }; + + $(window).resize(function(){ + resize(); + $(window).resize(function(){resize();}); }); Parameters: