我的mootools幻灯片代码出了什么问题?

时间:2010-02-09 03:26:35

标签: javascript animation mootools

我正在使用mootools制作手风琴式的内容部分。这是我正在使用的HTML:

<div class="content-add">
    <div class="item html 18" id="dditem_26">
        <a id="ddlink_26"></a>
        <a href="#" class="open ddheader"><strong>F. Tony Hosseini</strong></a>
        <p>F. Tony Hosseini is the Founder and Chairman of the FTH Group of companies.  He has over 30 years of experience in international business development, finance and private syndication work, developing and syndicating over $500 million dollars of industrial, commercial and residential projects around the world.</p>
        <p>Before coming to the United States, Tony lived in Iran (Persia) where he served as the project Quality Control officer for National Construction Company, developing the natural gas line between Iran and the USSR. He was also a General Partner for Iran-America Insurance Company, a multi-line insurance operation in the southern region of Iran.</p>
    </div>
    <div class="item html 19" id="dditem_25">
        <a id="ddlink_25"></a>
        <a href="#" class="open ddheader"><strong>Robert J. O'Leary</strong></a>
        <p>Robert J. (Bob) O'Leary is Vice Chairman of the FTH Group of companies.  He also serves as a partner at Insignia Building, LLC, a leading construction company operating in high-end residential communities in the Carolinas.  Bob brings with him over 30 years to the field of corporate public affairs, including communications, government affairs and brand management.</p>
        <p>A native of Pennsylvania, Bob is a graduate of Penn State University, where he was named an Alumni Fellow.  He serves on the Board of Visitors of the university's College of Communications, the college's campaign development committee, and regularly guest lectures and mentors students at the university.  He resides in Greenville, South Carolina.</p>            
    </div>
</div>

目标是在每个&lt; a&gt;下制作所有内容。单击a.open时,会有一组'open'滑出或in(切换)。这是我迄今为止的mootools JS:

$$('#content a.open').each(function(_link,i){
    var _slide = _link.getNext('div.slide');
    _slide.fx = new Fx.Slide(_slide).hide();
    _link.addEvent('click', function(){
        _link.toggleClass('open-slide');
        _slide.getParent('.contentcol').getElements('.slide').each(function(slide) {
            slide.slide('out');
        });
    _slide.fx.toggle();
});

滑块“按预期工作”,除了大部分时间,幻灯片都非常不连贯和“浮华”,如在幻灯片中,内容将随机消失并快速重新出现。有关此示例,请参阅http://fthgroup.blueinkcms.com/about_us/leadership_team#并单击其中一个名称。

任何想法我可能做错了什么?

1 个答案:

答案 0 :(得分:2)

您发布的代码与您网站的加价不符。你应该尽可能升级到mootools 1.2.4。

无论如何,对此问题进行故障排除以及Fx.Slide的性能问题(通过您网站的源文件)可能比从头开始编写要长得多。

http://www.jsfiddle.net/P9zJa/ - &gt;这个工作正常,重新考虑使用一个类,我希望它能给你一些想法。对html的改动很少或根本没有改进,但请注意我将p包裹在div.content

相关问题