jquery no-conflict script affecting layout template

banner2078 23 May, 2011
We are using CF v3.2, Joomla v1.5.22
We had a custom template built. Looks like the coder used jquery to control the columns... the left column extends/compresses to match the height of the content (main) column.

When we created a simple "Join Our Mailing List" form using Chronoforms 3.2, the validation (required fields) would not work unless we put in the no-conflict code found in these forums...

<script type="text/javascript">
$.noConflict();
// Code that uses other library's $ can follow here.
</script>

Works great except that now the left column remains fixed. What am I missing? I can provide a link to the form if you need it.
GreyHead 23 May, 2011
Hi banner2078 ,

No idea, sounds like a problem for your coder :-(

Please post a link to the form so we can take a quick look.

Bob
GreyHead 23 May, 2011
Hi banner2078,

I think that you have to replace the $ in the JQuery code after the no-conflict (effectively it gives the $ back to other scripts). Please try this
<script type="text/javascript">
$.noConflict();
// Code that uses other library's $ can follow here.
</script>
<script>
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = jQuery(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
jQuery(document).ready(function() {
equalHeight(jQuery(".block"));
});
</script> 

or perhaps more elegantly
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
  function equalHeight(group) {
    tallest = 0;
    group.each(function() {
      thisHeight = $(this).height();
      if(thisHeight > tallest) {
        tallest = thisHeight;
      }
    });
    group.height(tallest);
  }
  equalHeight($(".block"));
});
// Code that uses other library's $ can follow here.
</script> 

Not tested and I'm no jQuery expert !!

Bob
banner2078 23 May, 2011
That did it... wow, you're good Bob. Thank you very much!
This topic is locked and no more replies can be posted.