Forum Moderators: open
Can I encapsulate all the div tags into one DIV with overflow and the scorlling script applied to it?
Here's the scrolling code i'm using is there any way to apply it to a certain div tag that would hold all the other div tags?
i.e.
<div id="scrollingDIV" onFocus="scrollingFunction">
<div></div>
<div></div>
</div>functionScrolling()
//Scrolling
{
var currentScrollHeight = obj.scrollHeight;
if (currentScrollHeight >= parseInt(obj.style.height))
{
obj.scrollTop=(obj.scrollTop +100);
}
}
<div id="div1" onFocus="scrollingFunction();"></div>
<div id="div2" onFocus="scrollingFunction();"></div>
//
// Function to scroll all required divs
function scrollingFunction() {
scrollDiv(document.getElementById('div1'));
scrollDiv(document.getElementById('div2'));
}
//
// Function to scroll a particular div
function scrollDiv(obj) {
var currentScrollHeight = obj.scrollHeight;
if (currentScrollHeight >= parseInt(obj.style.height)) {
obj.scrollTop = obj.scrollTop + 100;
}
}