|
|
|
Fx.Slide Mootools вывод
|
|||
|---|---|---|---|
|
#18+
Уважаемые господа! Никак не могу справиться с проблемой. Используется функция Fx.Slide из библиотеки Mootols с помощью которой выводится блок с текстом с постраничной разбивкой на ajax. По умолчанию блок этой функцией выводится уже выведенным (извините за тафтологию), а мне нужно, чтобы был изначально скрытым. Если бы не было постранички, то все решается просто - добавлением mySlide.hide(); в начало скрипта, но при листании постранички в этом блоке в этом случае каждая страничка, естественно, вначале сбрасывается в hide Как этого избежать? Т.е. в идеале нужен вывод в скрытом режиме, а потом, в режиме mySlide.slideIn(); независимо от работы ajax внутри блока чтобы блок не скрывался, или другими словами. чтобы условие mySlide.hide(); в начале скрипта не действовало. По идее может это можно сделать в самой библиотеке, но в ней никак не разберусь как в описании функции сделать вывод срытым вначале работы скрипта. Очень нужна Ваша помощь. Срипт на странице: <script type="text/javascript">window.addEvent('domready' function(){ //-vertical var mySlide = new Fx.Slide('test'); mySlide.hide(); $('slideout').addEvent('click' function(e){ e = new Event(e); mySlide.slideOut(); e.stop(); }); $('slidein').addEvent('click' function(e){ e = new Event(e); mySlide.slideIn(); e.stop(); }); $('toggle').addEvent('click' function(e){ e = new Event(e); mySlide.toggle(); e.stop(); }); $('hide').addEvent('click' function(e){ e = new Event(e); mySlide.hide(); e.stop(); }); }); </script> А это описание функции в библиотеке: Fx.Slide = Fx.Base.extend({ options: { mode: 'vertical' } initialize: function(el options){ this.element = $(el); this.wrapper = new Element('div' {'styles': $extend(this.element.getStyles('margin') {'overflow': 'hidden'})}).injectAfter(this.element).adopt(this.element); this.element.setStyle('margin' 0); this.setOptions(options); this.now = []; this.parent(this.options); this.open = true; this.addEvent('onComplete' function(){ this.open = (this.now[0] === 0); }); if (window.webkit419) this.addEvent('onComplete' function(){ if (this.open) this.element.remove().inject(this.wrapper); }); } setNow: function(){ for (var i = 0; i < 2; i++) this.now = this.compute(this.from this.to ); } vertical: function(){ this.margin = 'margin-top'; this.layout = 'height'; this.offset = this.element.offsetHeight; } horizontal: function(){ this.margin = 'margin-left'; this.layout = 'width'; this.offset = this.element.offsetWidth; } /* Property: slideOut Sides the elements out of view horizontally or vertically. Arguments: mode - (optional string) 'horizontal' or 'vertical'; defaults to options.mode. */ slideOut: function(mode){ this[mode || this.options.mode](); return this.start([this.element.getStyle(this.margin).toInt() this.wrapper.getStyle(this.layout).toInt()] [-this.offset 0]); } /* Property: slideIn Slides the elements in view horizontally or vertically. Arguments: mode - (optional string) 'horizontal' or 'vertical'; defaults to options.mode. */ slideIn: function(mode){ this[mode || this.options.mode](); return this.start([this.element.getStyle(this.margin).toInt() this.wrapper.getStyle(this.layout).toInt()] [0 this.offset]); } /* Property: hide Hides the element without a transition. Arguments: mode - (optional string) 'horizontal' or 'vertical'; defaults to options.mode. */ hide: function(mode){ this[mode || this.options.mode](); this.open = false; return this.set([-this.offset 0]); } /* Property: show Shows the element without a transition. Arguments: mode - (optional string) 'horizontal' or 'vertical'; defaults to options.mode. */ show: function(mode){ this[mode || this.options.mode](); this.open = true; return this.set([0 this.offset]); } /* Property: toggle Slides in or Out the element depending on its state Arguments: mode - (optional string) 'horizontal' or 'vertical'; defaults to options.mode. */ toggle: function(mode){ if (this.wrapper.offsetHeight == 0 || this.wrapper.offsetWidth == 0) return this.slideIn(mode); return this.slideOut(mode); } increase: function(){ this.element.setStyle(this.margin this.now[0] + this.options.unit); this.wrapper.setStyle(this.layout this.now[1] + this.options.unit); }}); ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.04.2008, 17:20 |
|
||
|
|

start [/forum/topic.php?fid=22&fpage=337&tid=1456574]: |
0ms |
get settings: |
8ms |
get forum list: |
16ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
52ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
24ms |
get tp. blocked users: |
1ms |
| others: | 218ms |
| total: | 336ms |

| 0 / 0 |
