Nie działa zwijanie działu

Założony przez  Kacper Wojciechowski.

wersja skryptu MyBB: 1.6.16
adres forum: http://gvs-p4s.cba.pl/index.php
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu): Nie działa zwijanie działów, mój forumbit_depth1_cat

<div id="cat_{$forum['fid']}" class="content">
<div class="thead" id="th{$forum['fid']}">
<span class="forumtitle"><a href="{$forum_url}">{$forum['name']}</a></span><span class="forumdesc">{$forum['description']}</span>
<span class="expcolimage expcol_close"><img src="images/neonglow/collapse.gif" /></span>
<span class="expcolimage expcol_open"><img src="images/neonglow/collapse_collapsed.gif" /></span>
</div>
<div id="expcol_box{$forum['fid']}">
<table border="0" cellspacing="0" cellpadding="4" class="tborder tborder_2">
<tbody style="">
{$sub_forums}
</tbody>
</table>
</div>
<br />
</div>

oraz newfunctions.js :
$(document).ready(function () {

    var file_name, file_end, file_page, ucplink, dicon, ucpbox, sidebar, sidebarToggle, expopen, expclose, thead2, thead, thead_id, n, cookies, name, thnum, quoted, quoted_split;
    
    // Animated expand/collapse
    expopen = '.expcol_open';
    expclose = '.expcol_close';
    thead2 = '.thead_2';
    $(expclose).on("click", function () {
        thead = $(this).parent(thead2);
        thead_id = $(this).parent(thead2).attr("id");
        n = parseInt(thead_id.replace('th', ''), 10);
        $("#expcol_box" + n).slideUp();
        $(this).hide();
        thead.children(expopen).show();
        thead.animate({
            "border-radius": "5px",
            "opacity": "0.4"
        });
        $.cookie(n, "closed", {
            expires: 365
        });
        return false;
    });

    $(expopen).on("click", function () {
        thead = $(this).parent(thead2);
        thead_id = $(this).parent(thead2).attr("id");
        n = parseInt(thead_id.replace('th', ''), 10);
        $("#expcol_box" + n).slideDown();
        $(this).hide();
        thead.children(expclose).show();
        thead.animate({
            "border-radius": "5px",
            "opacity": "1"
        });
        $.cookie(n, "open", {
            expires: 365
        });
        return false;
    });

    // Restore collapses
    function get_cookies() {
        cookies = {};
        if (document.cookie && document.cookie !== '') {
            var split, i, name_value;
            split = document.cookie.split(';');
            for (i = 0; i < split.length; i += 1) {
                name_value = split[i].split("=");
                name_value[0] = name_value[0].replace(/^ /, '');
                cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
            }
        }
        return cookies;
    }

    cookies = get_cookies();
    for (name in cookies) {
        if (cookies[name] === 'closed') {
            $("#expcol_box" + name).hide();
            thnum = $("#th" + name);
            thnum.css('opacity', '0.4');
            thnum.find('.expcol_open').show();
            thnum.find('.expcol_close').hide();
        }
    }

    // Multiquote fix
    if ($.cookie('multiquote') !== null) {
        quoted = $.cookie("multiquote");
        quoted_split = quoted.split('|');
        $.each(quoted_split, function () {
            $('#multiquote_link_' + this).addClass('multiquote_on');
        });
    }

    $('a.postbit_multiquote').click(function () {
        if ($(this).hasClass('multiquote_on')) {
            $(this).removeClass('multiquote_on');
        } else {
            $(this).addClass('multiquote_on');
        }
    });

});
Sprawdź:
<div id="cat_{$forum['fid']}" class="content">
<div class="thead{$expthead}" id="th{$forum['fid']}">
<div class="expcolimage"><img src="{$theme['imgdir']}/{$expcolimage}" id="cat_{$forum['fid']}_img" class="expander" alt="{$expaltext}" title="{$expaltext}" /></div>
<span class="forumtitle"><a href="{$forum_url}">{$forum['name']}</a></span><span class="forumdesc">{$forum['description']}</span>

</div>
<div id="expcol_box{$forum['fid']}">
<table border="0" cellspacing="0" cellpadding="4" class="tborder tborder_2">
<tbody style="{$expdisplay}" id="cat_{$forum['fid']}_e">
{$sub_forums}
</tbody>
</table>
</div>
<br />
</div>
Ponadto kilka kwestii odnośnie JS, headerinclude:

Bibliotekę jQuery przeniósłbym nieco niżej, tuż za includowane skrypty. Dodaj także jQuery.noConflict();.

Teraz tworzysz styl / przerabiasz, czy co tam robisz..., ale przemyślałbym nad wersją MyBB 1.8.x, gdzie już tego stylu na pewno nie użyjesz.
Czyż nie lepiej od razu na wyższej wersji pracować?
Prośby na PW dotyczące wsparcia z problemami będą ignorowane. Pomoc poza forum - odpłatna; kontakt: snakemybboard@gmail.com.



Użytkownicy przeglądający ten wątek:

1 gości