首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的mootools幻灯片代码有什么问题?

我的mootools幻灯片代码有什么问题?
EN

Stack Overflow用户
提问于 2010-02-09 11:26:35
回答 1查看 573关注 0票数 0

我正在使用mootools制作一个手风琴类型的内容部分。下面是我正在使用的HTML:

代码语言:javascript
复制
<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>

这样做的目的是让每个a.open下的所有内容都有一个“打开”的类,无论何时点击它,都会滑出或滑入(切换)。以下是我到目前为止拥有的mootools JS:

代码语言:javascript
复制
$$('#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#并单击其中一个名称。

你知道我会做错什么吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-02-09 23:38:43

您发布的代码与您网站的标记不匹配。如果可能,您还应该升级到mootools 1.2.4。

无论如何,(通过您的站点的源文件)针对性能不佳的问题对其和Fx.Slide进行故障排除可能比从头开始编写要花费更长的时间。

http://www.jsfiddle.net/P9zJa/ ->这个工作很好,重构后使用了一个类,希望它能给你一些启发。只需很少或根本不修改html,它就会得到增强,但请注意,我将p打包成了一个div.content

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2226550

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档