[Seaside] Detect the position of a page div
Lukas Renggli
renggli at gmail.com
Wed Sep 23 06:28:17 UTC 2009
> Alright, I think I'm starting to understand the process of events here. What
> I'm still confused about, however, is exactly what "#text:" does. How is it
> able to render the value of "((html jQuery: #whatever) offset access:
> 'top')" when I can't assign that value to a component variable, render it
> with "#html:", or even show it with Transcript? Is that because the function
> has to be rendered (for JavaScript to deal with) first?
Unless you use AJAX, all the code execution happens in Javascript in
the web browser:
(html jQuery: #foo) text: (html jQuery: #bar) offsetLeft
In this case the expression is transformed to Javascript something
along the following lines:
$("#foo").text($("#bar").offset.left)
Have a look at the generated code in FireBug.
> How can I get the offset value and store it in an instance variable then?
Attach this script to the #onStop: handler of the draggable:
html ajax
callback: [ :value | left := value ] value: (html jQuery: #bar) offsetLeft;
callback: [ :value | top := value ] value: (html jQuery: #bar) offsetTop
Again check out the generated code in FireBug and inspect the request
it triggers off.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the seaside
mailing list