将phpFox的一个功能导入到SocialEngine

Importing a feature of phpFox to SocialEngine

本文关键字:功能 一个 导入 SocialEngine phpFox      更新时间:2023-09-26

phpFox发布了一个名为"Nebula"的主题,版本为3.5.0。在这个主题中,Header上有一个按钮,当用户单击按钮时,菜单会向下滑动。(实际上不是一个按钮,而是一个div)

我想把这个功能添加到SocialEngine。但是JavaScript代码包含一个phpFox变量,我不知道它指的是什么。我不太擅长JavaScript。

HTML:

<div id="nb_features">
  <a href="#" id="nb_features_link">Features</a>
  <div id="nb_features_holder">
    Menu widget code will be added here...
  </div>                                
</div>
JavaScript:

$Behavior.customNebula = function(){
    $('#nb_features_link').click(function(){
        if ($(this).hasClass('nb_is_clicked')) {
            $(this).removeClass('nb_is_clicked');
            $('#nb_features_holder').slideUp('fast');
        } else {
            $(this).addClass('nb_is_clicked');
            $('#nb_features_holder').slideDown('fast');
        }
        return false;
    });
};
CSS:

#nb_features {
    position:absolute;
    top:0px;
    right:0px;
}
#nb_features_link,
#nb_features_link:hover {
    display:block;
    width:40px;
    height:40px;
    line-height:40px;   
    text-indent:-1000px;
    overflow:hidden;
    background:url(~/application/modules/Wonder/externals/images/nb_features_link.png') no-repeat;
    margin-top:-7px;
    margin-right:20px;
}
#nb_features_link:hover {
    background:#334d83 url(~/application/modules/Wonder/externals/images/nb_features_link.png') no-repeat;
}
#nb_features a.nb_is_clicked,
#nb_features a.nb_is_clicked:hover {
    background:#334d83 url(~/application/modules/Wonder/externals/images/nb_features_link.png') no-repeat;
}
#nb_features_holder {
    position:absolute;
    background:#4f4f4f;
    right:0px;
    width:980px;    
    border:1px #304779 solid;
    border-top:0px;
    display:none;
    margin-top:20px;
}
#nb_features_holder ul li a,
#nb_features_holder ul li a:hover {
    float:left;
    color:#fff;
    height:30px;
    line-height:30px;
    padding:0px 10px 0px 10px;
    text-decoration:none;
}
#nb_features_holder ul li a.menu_is_selected,
#nb_features_holder ul li a.menu_is_selected:hover {
    background:#009AEF;
    color:#fff;
}
#nb_features_holder ul li a:hover {
    background:#2F2F2F;
    -webkit-transition: all 0.50s ease;
    -moz-transition: all 0.50s ease;
    -o-transition: all 0.50s ease;      
}

我该怎么做才能使这段代码与SocialEngine一起工作?

$Behavior命名空间是onLoad事件的包装器,这是你正在谈论的js变量吗?如果是,你可以用更传统的jquery/mootools/etc方式替换它,它可能会工作,尽管你必须正确匹配选择器,不知道你发布的代码是否你需要的一切