PDA

View Full Version : Help with Page Scroller -- endless scrolling



frontporch
11-18-2008, 01:00 PM
1) Script Title: Page Scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/pagescroller.htm

3) Describe problem: I'm using the Page Scroller in an iframe and am running into the problem where the page scrolls on forever. I have found several posts of this problem in the forums but haven't found a solution. Is there one??

Thanks in advance for any help!

jscheuer1
11-18-2008, 02:34 PM
Not happening here. I used a valid URL DOCTYPE for both the top page and the external page. And pretty simple markup for the external page. Both of these are probably pretty important, though the markup on the external page can be fairly complex I'd imagine, just nothing that would already require a scrollbar that isn't statically positioned. Also, it might be good to not have the external page's width exceed that of the iframe, though I'm not sure if that is important.

Top page:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<iframe src="external.htm" width="300" height="450" scrolling="no" frameborder="1"></iframe>
</body>
</html>

External page:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<p>simulated content</p>
<div id="staticbuttons" style="position:absolute;">
<a href="javascript:" onmouseover="myspeed=-thespeed" onmouseout="myspeed=0"><img
src="arrows_up.gif" border="0"></a><br>
<a href="javascript:" onmouseover="myspeed=thespeed" onmouseout="myspeed=0"><img
src="arrows_dn.gif" border="0"></a>
</div>

<script>

//Page Scroller (aka custom scrollbar)- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var Hoffset=70 //Enter buttons' offset from right edge of window (adjust depending on images width)
var Voffset=80 //Enter buttons' offset from bottom edge of window (adjust depending on images height)
var thespeed=3 //Enter scroll speed in integer (Advised: 1-3)

var ieNOTopera=document.all&&navigator.userAgent.indexOf("Opera")==-1
var myspeed=0

var ieHoffset_extra=document.all? 15 : 0
var cross_obj=document.all? document.all.staticbuttons : document.getElementById? document.getElementById("staticbuttons") : document.staticbuttons

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function positionit(){
var dsocleft=document.all? iecompattest().scrollLeft : pageXOffset
var dsoctop=document.all? iecompattest().scrollTop : pageYOffset
var window_width=ieNOTopera? iecompattest().clientWidth+ieHoffset_extra : window.innerWidth+ieHoffset_extra
var window_height=ieNOTopera? iecompattest().clientHeight : window.innerHeight

if (document.all||document.getElementById){
cross_obj.style.left=parseInt(dsocleft)+parseInt(window_width)-Hoffset+"px"
cross_obj.style.top=dsoctop+parseInt(window_height)-Voffset+"px"
}
else if (document.layers){
cross_obj.left=dsocleft+window_width-Hoffset
cross_obj.top=dsoctop+window_height-Voffset
}
}

function scrollwindow(){
window.scrollBy(0,myspeed)
}

function initializeIT(){
positionit()
if (myspeed!=0){
scrollwindow()
}
}

if (document.all||document.getElementById||document.layers)
setInterval("initializeIT()",20)

</script>
</body>
</html>