• Качественное строительство загородных домов в Омске и пригороде Русскими строителями.

    Matching Columns Script – Update. – Web design video tutorials for beginners

    { Posted on Jun 08 2012 by seoman }
    Categories : news area

    Hi,

    I decided to create another blog post to make it easier to find the updated version of the important matching columns script – it was buried in the originals article’s comments.

    Notes:

    -

    Updated script by: Jonathan del Mar

    I have modified the script to work with multiple class groups also with elements with multiple class names

    /*

    Derived from a script by Alejandro Gervasio.

    Modified to work in FireFox by Stefan Mischook for Killersites.com

    Modified to work with multiple class groups also with elements with multiple class names

    by Jonathan del Mar (dec-14-2006)

    How it works: just apply the CSS class of ‘column’ to your pages’ main columns.

    to work with different classes

    add

    var columns = new Array(’class_name1?, ‘class_name1?…);

    by Jonathan del Mar

    by default the script will call

    matchColumns();

    and the default class_name is ‘column’

    (see the bottom of this script)

    by Jonathan del Mar

    */

    matchColumns=function(my_class){

    var divs,contDivs,maxHeight,divHeight,d;

    // get all elements in the document

    divs=document.getElementsByTagName(’div’);

    contDivs=[];

    // initialize maximum height value

    maxHeight=0;

    if (!my_class) {

    my_class = ‘column’;

    }

    my_regex = new RegExp(’(.* |^)’ + my_class + ‘( .*|$)’);

    // iterate over all elements in the document

    for(var i=0;i elements with class attribute ‘container’

    //if(/bcolumnb/.test(divs[i].className)){

    // modified by Jonathan del Mar to match ‘column’ in multiple classes

    if(my_regex.test(divs[i].className)){

    d=divs[i];

    contDivs[contDivs.length]=d;

    // determine height for element

    if(d.offsetHeight){

    divHeight=d.offsetHeight;

    }

    else if(d.style.pixelHeight){

    divHeight=d.style.pixelHeight;

    }

    // calculate maximum height

    maxHeight=Math.max(maxHeight,divHeight);

    }

    }

    // assign maximum height value to all of container elements

    for(var i=0;i

    var columns = new Array(’class_name1?, ‘class_name2?, …);

    to your html header.

    www.killersites.com

    Related Posts

    • 06/11/2012 -- HomeSite and BBEdit
      I’ve never tried to cut a wooden log in two w...
    • 06/06/2012 -- Fonts
      By far, the most obvious difference between M...
    • 06/08/2012 -- The SEO Paradox
      Could spending thousands of dollars, and mont...

    Sorry, comments for this entry are closed at this time.