Claudio, do you have an example page?
Something I had attempted that is KIND of similar, I was able to do
something along the lines of:
(oh, this is abridged, btw):
window.addEvent('domready', function(){
init_addEventsToThings($$('.stuff_that's_all_ready_there'));
init_ILoadStuff();
});
function init_addEventsToThings(el){
el.addEvent('click',function(element){
//I do stuff
});
}
function init_ILoadStuff(){
// basically I had the onSuccess AJAX call recall the function
pointing to the newly added item.
}
If you are incrementing the ID by 1 (and starting at say, 0 or 1) you
can $$('accordion_el[id^=accordion_ID]').length or something similar.
-keif
On Dec 26, 11:22 am, "Claudio Moretti" <[email protected]> wrote:
> no ideas? :(
>
> On Wed, Dec 17, 2008 at 23:34, Claudio Moretti <[email protected]>wrote:
>
> > I thought about it, but there's a problem: every element of the accordion
> > has its own ID (that changes by an integer, but changes); How can I tell the
> > "active" event to load only the content of the div which was clicked?
>
> > On Wed, Dec 17, 2008 at 23:12, Guillermo Rauch <[email protected]> wrote:
>
> >>http://mootools.net/docs/Plugins/Accordion
> >> Events : active
>
> >> you might want to fetch the content in the onActive event, which is fired
> >> when any accordion item is opened.
>
> >> That way you don't have to deal with the clicks events, and it's much more
> >> flexible (for example, there're some scenarios where the accordion section
> >> is opened without a click being involved).
>
> >> On Wed, Dec 17, 2008 at 8:00 PM, Claudio <[email protected]> wrote:
>
> >>> Hi all,
> >>> I'm trying to build a webapp (PHP) that dynamically loads an
> >>> accordion, and I'm stuck with a problem: I don't want the content of
> >>> the accordion to be loaded with the accordion itself; so I created a
> >>> LoadContent() Javascript function to be invoked when I click on the
> >>> title of the accordion.
> >>> Since the accordion elements number is variable, I needed to build the
> >>> same number of "addEvent" at the bottom of my page;
> >>> My problem is: when the content of this page is requested, the
> >>> "addEvent" events are not added, but executed; the accordion content
> >>> is completely loaded (FireBug says that) and i don't need an
> >>> "addEvent" function any more (which I don't want).
> >>> I've tried adding the "domready" event, but it doesn't change
> >>> anything.
> >>> How can I do?
> >>> Thanks,
> >>> Claudio
>
> >> --
> >> Guillermo Rauch
> >>http://devthought.com