-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am trying to get the following to work - which it does not, since the scrollTo javascript function does not exist on the zk window object. How can I go about getting the true window object that will accept this function?
<?page zscript-language="javascript"?> <window id="win"> <zscript> function hideURLbar() { win.scrollTo(0, 1); } </zscript> <button label="Hide URL Bar on IPhone"> <attribute name="onClick"> hideURLbar(); </attribute> </button> </window>
to access clientside javascript you would have to use the action attribute
<button action="onclick:window.scrollTo(0,1)" />
onClick is a serverside click
That definitely works as far as getting javascript to get called and run, I put in action="onClick:alert('foo');" to test and that worked. The scrollTo is still not working and I suspect that I am not actually getting to the javascript "window" object. How do I reference it inside the .zul file, do I use the zk id I have assigned or another method?
Thanks again for the help.
I tried using the Clients class and it's scrollTo method with no luck getting the URL bar on the Itouch to hide.
<dhITouchWindow id="_zonesWindow" apply="com.dh.ui.itouch.composer.zone.DHzZonesComposer" onLoad="scrollTo()"> <zscript> void scrollTo() { Clients.scrollTo(0,100); } </zscript>
<button action="onclick:window.open()"/>
opens a window.
<button action="onclick:if(window.scrollTo) {alert('oke!');window.scrollTo(10,0);}"/>
one alert, no errors
Maybe scrollTo is not supported by all browsers, maybe you refer to win and is win not the browser window, maybe you use scrollTo in a faulty way.
I know nothing about scrollTo
regards, huub
Asked: 2008-11-13 19:57:50 +0800
Seen: 361 times
Last updated: Nov 14 '08