gotfredsen wrote:
> I´ve seemed to fix the issue a little bit with a custom event .. but
> the fix is yerky and wont update the scroll handle height smoothly ..
>
> when the accordion is expanded I send a custom event that tells the
> scrollbar to update .. but hey there must be some simple way to
> monitor a div in prototype ..
>
> For example say that I have a <div id="content">bla bla bla</div>
>
> and then sudenly that div is updated with some new content <div
> id="content">hfkjdahsfkjdsah hfkdjahf</div>
> then there must be some kund of onChange function that can tell the
> scrollbar that the div have changed ????
>
If the div is updated using Prototype's Element#update, you could fire a
custom event from the update function to alert other scripts of the change:
(function() {
var oldUpdate = Element.Methods.update;
Element.addMethods({
update: function(element, html) {
element = $(element);
var oldHtml = element.innerHTML;
oldUpdate(element, html);
element.fire('dom:update', {prevValue: oldHtml, newValue: html});
return element;
}
});
})();
$('content').observe('dom:update', function(event) {
// update the scrollbar however
scrollbar.update();
});
- Ken Snyder
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---