cristi
cristi

Reputation: 397

Why is not this calculation correct?

I have this site:

link

CODE JS:

    var windowsize = $(window).outerWidth();
    $('#main-content').css('overflow','hidden');
    console.log('latime:',windowsize);
    var stanga= jQuery('#secondary').outerWidth();
    console.log('stanga:',stanga);
    var dreapta= jQuery('.right').outerWidth();
    console.log('dreapta:',dreapta);
    var contentwh=windowsize-stanga-dreapta;
    $('#main-content').css('width',contentwh);
    var content= jQuery('#main-content').outerWidth();
    $('.navbar-fixed-top').css('width',contentwh);

My div (#main-content) must be exactly as the remaining space.

Unfortunately to me is slightly larger look at the picture below ...

enter image description here

What is wrong with this calculation?

Upvotes: 1

Views: 97

Answers (1)

Bhavin
Bhavin

Reputation: 789

Hi I got your Problem.

Image

You haven't calculate padding of "secondary" div So Calculation is like for secondary div is

 var stanga= jQuery('#secondary').outerWidth() + 30;

Hope this will solved your problem.

thanks.

Upvotes: 2

Related Questions