Executing a static javascript function after every event


#1

Hi,

is there any way to (automatically?) call a javascript function
whenever something has happened in the view? Or at least when the view
has changed.

I.e. I have a function that vertically resizes and positions elements
on a page after checking the content, and I’d like it to update those
every time the content has changed.

With , it only works for the first view, “/” or
“/frontpage/”, but not the rest.

The html, head (and script), body tag, etc is located in a partial,
_a.rhtml, that is in views/layouts and is used across the different
views, like frontpage.rhtml, news.rhtml and so on.

Thanks,
Bjørn


#2

prism wrote:

is there any way to (automatically?) call a javascript function
whenever something has happened in the view? Or at least when the view
has changed.

My Short Cut with O’Reilly describes how to abuse^W activate the
prototype.js handlers like this:

Ajax.Responders.register({ onComplete: function(request) {…} } )

Then detect your event type inside that handling method.


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax