I'm using this Fx.Slide script in my site:
var togglers = $$('.toggler'), expanders = $$('.expandable');
togglers.each(function(toggler, index){
var fx = new Fx.Slide(expanders[index]).hide();
toggler.addEvents({
click: function(e){
e = new Event(e);
fx.toggle();
e.stop();
return false;
}
});
});
Which is working just fine. What I wasn't able to do is get the current st开发者_如何学Cate of the slide so I can assign some open/closed icons on the toggler element.
Thanks!
Hi you can use the attribue open of the slider:
if(fx.open){
//whatever you need to do
}else{
//whatever you need to do
}
i think you need put the slider in an array to be able to access them later...
hope this helps
You could even store the Fx.Slide
s in the togglers themselves, if you don't want to keep a separate array.
[...]
togglers.each(function(toggler, index){
var fx = new Fx.Slide(expanders[index]).hide();
expanders[index].store('slide',fx)
toggler.addEvents({
[...]
});
});
Then later you can check the status, like mklfarha said:
if(expanders[index].retrieve('slide').open){
//do some stuff
}
精彩评论