Dynapi Gurus,
I'm having trouble with centering content within a loadpanel-scrollpane
combo. I basically want to center content that is read into a scrollpane via
setURL. I have put together some code that you can play with that illustrates
the problem I am experiencing. Basically, when I center the loadpanel using
an onload event listener attached to the loadpanel, the loadpanel will center
in the scrollpane but becomes obscured due to what appears to be a clipping
issue.
When this example first loads you will see the smaller content slide away as
it is centered. Load file two and you will see it is partially cut off. Move
the loadpanel to 0,0 using the provided link and you will see file 2 in it's
entirety.
Any help on this is appreciated cause my head hurts from banging it on the
wall ;-)
-------------Sample Code runs from dynapi/examples dir -----------
<html>
<head>
<Script language="Javascript" src="../src/dynapi.js"></script>
<Script language="Javascript">
DynAPI.setLibraryPath('../src/lib/')
DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.util.thread.js');
DynAPI.include('dynapi.util.pathanim.js');
DynAPI.include('dynapi.util.debug.js');
DynAPI.include('dynapi.ext.inline.js');
DynAPI.include('dynapi.ext.images.js');
DynAPI.include('dynapi.ext.slide.js');
DynAPI.onLoad=function() {
JT=DynAPI.document
L11=new LoadPanel()
L11.autoH=true;
L11.autoW=true;
L11.setSize(200,20)
L11.moveTo(0,0)
L11.setBgColor('#ffff00')
L11el = new EventListener(L11)
L11el.onload = function(e) {
o = e.getTarget()
var newX = L12.getWidth()/2 - o.getWidth()/2
var newY = L12.getHeight()/2 - o.getHeight()/2
o.slideTo(newX,0)
}
L11.addEventListener(L11el)
L12=new ScrollPane(L11)
L12.setSize(600,400)
L12.moveTo(80,20)
L12.setBgColor('#0000ff')
JT.addChild(L12)
// in case anyone wonders what this is for, I found that setURL does
// not work while document is loading without a slight delay
setTimeout("delayed()", 1)
}
function delayed() {
L11.setURL('sample1.html')
}
</script>
</head>
<BODY bgcolor="lightblue">
<BR><BR>
<p>Load Files:
<br><a href="javascript:L11.setURL('sample1.html')">file 1</a>
<br><a href="javascript:L11.setURL('sample2.html')">file 2</a>
<p>Set Width:
<br><a href="javascript:L11.setWidth(150)">150</a>
<br><a href="javascript:L11.setWidth(250)">250</a>
<br><a href="javascript:L11.setWidth(350)">350</a>
<br><a href="javascript:L11.setWidth(450)">450</a>
<br><a href="javascript:L11.setWidth(550)">550</a>
<br><a href="javascript:L11.setWidth(650)">650</a>
<br><a href="javascript:L11.setWidth(750)">750</a>
<br><a href="javascript:L11.setWidth(850)">850</a>
<br><a href="javascript:L11.setWidth(950)">950</a>
<p><a href="javascript:L11.clearFile()">Clear</a><BR>
<a href="javascript:L11.moveTo(0,0)">move to 0,0</a><BR>
</BODY>
</HTML>
---------------- end sample code ----------------------
--support file 1 name it sample1.html place in dynapi/examples ---
<HEAD><BODY><TABLE WIDTH=100 BORDER=1><TR><TD>
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah
</TD></TR></TABLE></BODY></HTML>
---------End support file 1------------------------------
--support file 2 name it sample2.html place in dynapi/examples ---
(same as sample1.html but table width is set to 500)
---------End support file 2------------------------------
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help