Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

Equal Heights script

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

In previous versions (in other words J1.5) there was a script that was able to be renamed in order to activate an equal heights script.

I've found that script again, and this time I'm adding it to template.js inside the template

My template.js file now has the folllowing appended to the bottom.


// Equal Heights Script
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = jQuery(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}

equalHeight(jQuery(".grid2wrap .moduletable"));


But... I'm not able to make it work.

Any advice greatly appreciated
  • normdouglas's Avatar
  • normdouglas
  • LIfetime Developer - Big Bamboo
  • 45 posts
  • Karma: 0
The administrator has disabled public write access.
Hi Norm,

Prob need a link to troubleshoot this one properly.

Anthony
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Sorry my mistake.

2012.mtbskills.com.au

If you see on the front page, there is the modules that I wish to make equal.

The script is loading via the template.js
  • normdouglas's Avatar
  • normdouglas
  • LIfetime Developer - Big Bamboo
  • 45 posts
  • Karma: 0
The administrator has disabled public write access.
No worries.

The inspector is showing a parse error which likely means a missing )}; to close the code.

Also you have commented out the leftCol etc variables but not the line below it that relates to the leftCol so that will throw an error as well.
   // Equal Heights Script
    function equalHeight(group) {
    var tallest = 0;
    group.each(function() {
        var thisHeight = jQuery(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
    }

    equalHeight(jQuery(".grid2wrap .moduletable"));
    //equalHeight(jQuery(".cols2 .jbCategory"));

    
    //equalHeight(jQuery("#mainContent,#rightCol"));
    //equalHeight(jQuery(".jbSection"));
    
    //var leftCol = jQuery('#leftCol').height();
    //var rightCol = jQuery('#rightCol').height();
    //var centerCol = jQuery('#centerCol').height();
    //var centerCol = jQuery('.cols2 .jbCategory').height();
    
    if (leftCol > 0 || centerCol > 0 || rightCol > 0){
    equalHeight(jQuery("#left,#center"));
    }
});
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Actually during further testing last night, I tried to use an older script from another site...

So I'll put the new on in there now and configure.
Give me 3 mins
  • normdouglas's Avatar
  • normdouglas
  • LIfetime Developer - Big Bamboo
  • 45 posts
  • Karma: 0
The administrator has disabled public write access.
New script is now in there.
  • normdouglas's Avatar
  • normdouglas
  • LIfetime Developer - Big Bamboo
  • 45 posts
  • Karma: 0
The administrator has disabled public write access.
That code is also outside of the

jQuery(document).ready(function(){

so it doesn't fire properly.

If you move it into the brackets or just wrap it in another ready it should work.
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
The following user(s) said Thank You: normdouglas
A million thank you oh great one!
  • normdouglas's Avatar
  • normdouglas
  • LIfetime Developer - Big Bamboo
  • 45 posts
  • Karma: 0
The administrator has disabled public write access.
Thanks mate!
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers