Ticket #929 (new enhancement)
Slide - toggling while slidingIn or out
| Reported by: | 3dcreator | Owned by: | |
|---|---|---|---|
| Type: | enhancement | Priority: | trivial |
| Milestone: | Mootools version 1.3 | Component: | Plugins |
| Keywords: | Cc: |
Description
While using slide with long time of animation user can fire event causing slide in while slider is sliding out and vice versa. This can cause some unsmooth animation - jumps.
I've modified slider code like this:
Added in initialize:
this.state = 'expanded';
and modified this:
this.addEvent('onComplete', function(){
this.open = (this.now[0] === 0);
if(this.open==true) this.state='expanded'
else this.state='collapsed';
});
and modified code of several functions:
slideIn: function(mode){
this.state='expanding';
this[mode
this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [0, this.offset]);
},
slideOut: function(mode){
this.state='collapsing';
this[mode
this.options.mode]();
return this.start([this.element.getStyle(this.margin).toInt(), this.wrapper.getStyle(this.layout).toInt()], [-this.offset, 0]);
},
hide: function(mode){
this.state='collapsed';
this[mode
this.options.mode]();
this.open = false;
return this.set([-this.offset, 0]);
},
show: function(mode){
this.state = 'expanded';
this[mode
this.options.mode]();
this.open = true;
return this.set([0, this.offset]);
},
toggle: function(mode){
if((this.state == 'expanded')
(this.state == 'expanding'))
{
this.state='collapsing';
return this.slideOut(mode);
}
else
{
this.state='expanding';
return this.slideIn(mode);
}
},
I believe that providing variable that contains current state of slider makes it better and easier to use.
Cheers
3Dcreator
Change History
Note: See TracTickets for help on using tickets.Download in other formats: