javascript - How to properly append html into a div, so if the div becomes too large in height, I can scroll its content -
i need append html content retrieved url inside div.
this html code:
<div id="top-container"> <div id="views-container"> <div id="html-container"> </div> <div id="original-page-container"> </div> <div id="result-page-container"> </div> </div> </div>
and script , paste page content is:
$.get("http://alf.wikia.com/wiki/alf_goes_wild", function(data) { $("#original-page-container").append($(data).find(".wikiamaincontentcontainer").html()); });
this can , paste data succesfully inside div, problem new html exceeds dimentions of original-page-container div , need retrieved content fits dimensions of div, if height greater, should able scroll div.
i hope explained myself clearly.
this jfiddle (the script works in browser internet security disabled): http://fiddle.jshell.net/dc5pq/
thanks in advance!
just apply overflow:auto;
div
.
that way: scroll appear when data bigger available space.
notice div become scrollable if have height
or max-height
, otherwise grow long fit content.
Comments
Post a Comment