在jQuery中展开MyBB中的Category

时间:2013-05-16 17:01:49

标签: jquery expand collapse mybb

又是我了:D

如您所知(或不知道),MyBB使用Prototype扩展论坛表。但我正在为我的论坛编写和设计一个新的主题,而不是使用表格,是的,MyBB的完整div主题。

因此,我无法使用MyBB的内置扩展功能来设计表格。

以下是我展开/折叠论坛类别的代码。

Javascript:

jQuery.noConflict();

function toggleForums(catId) {
    var forumCategoryId = "#cat_" + catId;

    jQuery(forumCategoryId).click(function() {
        jQuery(this).next().toggle();
    });

    jQuery(forumCategoryId).click(function() {
        jQuery(this).toggleClass('.forum-parent collapsed').toggleClass('.forum-parent');
    });
}

HTML(forumbit_depth_1_cat)

<a id="cat_{$forum['fid']}" href="javascript:;" class="forum-parent" onclick="toggleForums({$forum['fid']});">{$forum['name']}</a>
<div class="child-forums" name="cat_{$forum['fid']}" id="cat_{$forum['fid']}_e" style="{$expdisplay}">
<div class="forums-list">
{$sub_forums}
</div> <!-- /end forums-list -->
</div> <!-- /end child-forums -->
<span class="clear"></span>

是的,以前的代码没有用。只有在 onclick事件

中使用此jquery时,它才会起作用
onclick="jQuery(this).next().toggle();jQuery(this).toggleClass('.forum-parent collapsed').toggleClass('.forum-parent');"

如果我使用onclick事件,那么我无法设置cookie以保存当前可扩展的用户。

我需要你的建议,伙计。

先谢谢!

1 个答案:

答案 0 :(得分:1)

尝试用此替换您的Javascript代码。希望它可能有所帮助。

elif n%prime[:]==0
     n=n+1