小编Shu*_*med的帖子

Bootstrap在加载时折叠

我用这个脚本

$(function () {
$('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
$('.tree li.parent_li > span').on('click', function (e) {
    var children = $(this).parent('li.parent_li').find(' > ul > li');
    if (children.is(":visible")) {
        children.hide('fast');
        $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
    } else {
        children.show('fast');
        $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
    }
    e.stopPropagation();
});
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/jhfrench/GpdgF/

用于递归可折叠菜单.它完美地运作.但是我需要最初折叠的菜单,即页面加载并仅在单击时展开.

我的JS知识很薄弱.但我尝试使用toggle(); 并隐藏(); ,它会导致折叠,并且在点击时不会扩展

下面是递归的PHP代码

<?php
function listroles($roles)
{
    ?>
    <ul>
    <?php
    foreach($roles as $role)
    {
        ?>
        <li>
            <span><i class="icon-plus "></i> Parent</span> <a href="<?php echo $role['category']->slug; ?>"><?php echo $role['category']->name; ?></a> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap

4
推荐指数
1
解决办法
5011
查看次数

致命错误:调用未定义的函数 locale_get_default()

我收到此错误:

致命错误:调用locale_get_default()Linux 主机 (cpanel) 上未定义的函数。PHP版本是5.3

我用它来检测用户的位置和语言

这里 PHP 文档和它有一个示例代码

http://php.net/manual/en/locale.getdefault.php

我在使用 xampp 的 localhost 中遇到了同样的问题,并使用localhost 上的这篇文章 locale_get_default() 函数问题解决了它

但在网络托管中我遇到了同样的错误

php shared-hosting

-2
推荐指数
1
解决办法
9190
查看次数