Return to Snippet

Revision: 42004
at February 26, 2011 02:00 by shinokada


Initial Code
$(document).ready(function() {
var len = $('#infoinner tr').size();
if (len>15 && len<50){
var roundlen = Math.round(len*1.5);
}
else if (len>50 && len<75){
var roundlen = Math.round(len*2.4);
}
else if (len>75 && len<100){
var roundlen = Math.round(len*3.6);
}
else if (len>100 && len<150)
{
var roundlen = Math.round(len*4.8);
}else if (len>150 && len<200)
{
var roundlen = Math.round(len*6);
}else 
{
var roundlen = Math.round(len*7);
}
if(len<15)
{
var margintop = '0';
$('#infoinner table').css('margin-top',margintop);

}else{
var margintop = '-'+ roundlen +'px';
}
$('#infoinner').css('margin-top',margintop);

});

Initial URL

                                

Initial Description
Depends on the number of tr tag, it will add a negative margin-top except less than 15

Initial Title
Visma CMS Adding negative margin-top depends on number of TR tag

Initial Tags

                                

Initial Language
JavaScript