Hello,
I have a div that I need to be a certain size. However, most of the time, there will be an overflow scroll. Within this div, I have other hidden divs. These hidden divs will be displayed on an "onClick" event. However, these same div will then be hidden again when another onClick event happens. This is working just fine. My issue is that I need for the div to be scrolled to the top on each onClick event.
This is the code that I have so far.
Thanks in advance
-SM
I have a div that I need to be a certain size. However, most of the time, there will be an overflow scroll. Within this div, I have other hidden divs. These hidden divs will be displayed on an "onClick" event. However, these same div will then be hidden again when another onClick event happens. This is working just fine. My issue is that I need for the div to be scrolled to the top on each onClick event.
Code:
function showArticle(artID) {
/*First check to see if the user is clicking the open article*/
if(document.getElementById("article_" + artID).style.display == 'block') {
document.getElementById("article_" + artID).style.display = 'none';
} else {
/*Close all open articles*/
var allArticleTags=document.getElementsByTagName("*");
var counter = 0;
for(i=0; i<allArticleTags.length; i++) {
if(allArticleTags[i].className == "dailyArticle") {
counter++;
allArticleTags[i].style.display = 'none';
}
}
/*Show clicked article*/
var scrollHeight = 1000;
document.getElementById("article_" + artID).style.display = 'block';
document.getElementById("content").scrollTop = document.getElementById("content").scrollTop + scrollHeight;
}
}
This is the code that I have so far.
Thanks in advance
-SM