Left Navigation won't expand to 100% Magento

2019-09-06 10:14发布

问题:

I am working on a Magento store at: http://nscar.org/magento/

I am trying to get the left navigation to expand to 100% of the container that the products are in. Any suggestions would be much appreciated.

回答1:

I'm guessing what you really want to do is to have the orange background repeat over the whole left sidebar. For that you just need to set the background for #left instead of #publicnav.

In /magento/skin/frontend/default/css/styles.css add this where appropriate:

#left {
    height: 100%;
    background:url('http://www.nscar.org/images/background.gif');
    background-repeat:repeat-y;
}


回答2:

In your css for .col-left the background image isn't being found, changing it from ..images/background.gif to ../images/background.gif works.



回答3:

Try to set height of the left menu dynamically using javascript according to the main body of the page. The below code will helps you.

<script>
var leftH       = 0;
var rightH      = 0;
var minHeight   = 0;

function resize() {  
    leftH   = document.getElementById('box7-container').offsetHeight;
    rightH  = document.getElementById('box8-container').offsetHeight;
    minHeight= (leftH > rightH) ? leftH : rightH ;

    adjust_heights();
}

function adjust_heights() {
    var left    = document.getElementById('leftDivId');
    var right   = document.getElementById('rightDivId');
    minHeight = minHeight - 9;
    if(rightH == minHeight)
        left.style.height   = (minHeight) + 'px';
    else
        right.style.height  = (minHeight) + 'px'; 
}
resize();
</script>

Change the leftDivId and rightDivId with appropriate div ids.



标签: magento css