![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| JavaScript JavaScript are you needing help with functions in your script, free help is offered here for all JavaScript problems so if you have an JavaScript error in your code just ask. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I have some content in a scrollable iframe. I update this content every 5 seconds using setInterval(). After updating the contents, I force the window to scroll to the bottom (scrollBy), where I've placed the most current content. The window is scrollable, so the user can scroll to the top (older content) and read it if they wish. The code does add new content to the bottom and scroll to the bottom... here it is: function refreshContent(newContent) { var tr, td; tbody = parent.frameContent.bodyContent; // Add new content at the bottom for (var i = 0; i < newContent.length; i++) { tr = tbody.insertRow(tbody.rows.length); td = tr.insertCell(tr.cells.length); td = tr.insertCell(tr.cells.length); } // scroll to bottom of chat window parent.frmChat.scrollBy(0,10000); } Here's the problem. If a user has scrolled to the top of the window to read, when the Interval kicks off, they are shot down to the bottom of the page again, and lose their place. Is there some way for me to check if the user is reading the window (i.e., not scrolled to the bottom), and skip the scrollBy? Something like: // check window scrollPosition before adding new text scrollPosition = ??????; // Add new content at the bottom [...] // scroll to bottom of chat window, if it was at the bottom before I added content if ( scrollPosition == [BOTTOM] ) { parent.frmChat.scrollBy(0,10000); } Any ideas? Thanks! Mike | |||
| Featured Websites | ||||
|
![]() |
| Tags: figuring, iframe, scrolled, user |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New xbox user | Peter | Console Subjects | 3 | 12-01-2007 6:35 AM |
| bookmark and iframe | linz | HTML | 0 | 07-01-2007 1:46 PM |
| Help, new GPS user | alekz | GPS | 0 | 06-12-2007 5:18 PM |
| User pages - Can HTML Be Used | $atom | New User Help | 2 | 04-18-2007 11:19 AM |
| User page | JeJe | Community Chat | 0 | 07-05-2006 9:06 PM |
| Featured Websites | ||||
|