Search code examples
javascriptcssdynamic-data

Body won't scroll when dynamic content added


Live link here: http://tbremer.com/

Try Architecture or Concert to see problem

My issue is that when my images are added the viewport doesn't scroll or extend to allow for the new content.

I need to understand what the root issue is here and hopefully find a work around.

Thanks!

OK, sorry here is the pertinent code.

CSS:

/* Content Wrapper */
#contentWrapper {
    padding: 0px;
    margin: 0px;

    width: 100%;
    height: 99%;

    z-index: 0;

    border: 0px solid #600;
}

/* Image Viewer */

#imageViewer{
    position: fixed;
    left: 0px;
    top: 0px;

    padding: 0px;
    padding-left: 350px;
    margin: 0px;

    border: 0px solid #F0F;

    visibility: hidden;
}

.portImage {
    padding: 0;
    margin: 4px;

    border: 1px solid #000;

    display: inline;
}

HTML:

<div id="contentWrapper">
    <div id="imageViewer"></div>
</div>

JAVASCRIPT:

xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
            $("#imageViewer").empty();
            $("#imageViewer").css("visibility", "hidden");

            //___ Get server response.
            var responseArray = xmlhttp.responseText.split(',');
            responseArray.pop();

            //console.log(responseArray.length);
            //console.log(responseArray);

            for(var i=0;i<responseArray.length;i++){
                $("#imageViewer").append("\
                    <div id='portImage"+i+"' class='portImage'>\
                        <img src='"+responseArray[i]+"' height='500'>\
                    </div>\
                ");
            }

            $(".portImage").each(function() {
                var image = $("<img />").attr('src', this);
            });

            //$("#imageViewer").append("Test");
            $("#imageViewer").css("visibility", "visible");
        }

    }

Solution

  • You need to remove the height from #contentWrapper and position: fixed from #imageViewer.

    (And please post your code here.)