добавил указанную вами функцию в овералхэдэр - заработал, но как-то криво.
во-первых, скрытие не запоминается и при переходе или обновлении страницы сбрасывается.
во вторых, работает только ссылка вида
Код: Выделить всё
<a href="#" name="hide" ...Код: Выделить всё
<a href="#" name="hide" ...

Код: Выделить всё
dE('hidden', (readCookie('hidden_block') || -1));Код: Выделить всё
var style_cookie = 'phpBBstyle';
var style_cookie_settings = '{A_COOKIE_SETTINGS}';простите, но в какое именно место?Nekstati писал(а):И надо ещё добавить это в скрипт в overall_header.html:
Код: Выделить всё
function createCookie(name, value, days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = '; expires=' + date.toGMTString();
var style_cookie = 'phpBBstyle';
var style_cookie_settings = '{A_COOKIE_SETTINGS}';
}
else
{
expires = '';
}
document.cookie = name + '=' + value + expires + style_cookie_settings;
}
Код: Выделить всё
var array = new Array();
var speed = 8;
var timer = 8;
// Loop through all the divs in the slider parent div //
// Calculate seach content divs height and set it to a variable //
function slider(target,showfirst) {
var slider = document.getElementById(target);
var divs = slider.getElementsByTagName('div');
var divslength = divs.length;
for(i = 0; i < divslength; i++) {
var div = divs[i];
var divid = div.id;
if(divid.indexOf("header") != -1) {
div.onclick = new Function("processClick(this)");
} else if(divid.indexOf("content") != -1) {
var section = divid.replace('-content','');
array.push(section);
div.maxh = div.offsetHeight;
if(showfirst == 1 && i == 1) {
div.style.display = 'block';
} else {
div.style.display = 'none';
}
}
}
}
// Process the click - expand the selected content and collapse the others //
function processClick(div) {
var catlength = array.length;
for(i = 0; i < catlength; i++) {
var section = array[i];
var head = document.getElementById(section + '-header');
var cont = section + '-content';
var contdiv = document.getElementById(cont);
clearInterval(contdiv.timer);
if(head == div && contdiv.style.display == 'none') {
contdiv.style.height = '0px';
contdiv.style.display = 'block';
initSlide(cont,1);
} else if(contdiv.style.display == 'block') {
initSlide(cont,-1);
}
}
}
// Setup the variables and call the slide function //
function initSlide(id,dir) {
var cont = document.getElementById(id);
var maxh = cont.maxh;
cont.direction = dir;
cont.timer = setInterval("slide('" + id + "')", timer);
}
// Collapse or expand the div by incrementally changing the divs height and opacity //
function slide(id) {
var cont = document.getElementById(id);
var maxh = cont.maxh;
var currheight = cont.offsetHeight;
var dist;
if(cont.direction == 1) {
dist = (Math.round((maxh - currheight) / speed));
} else {
dist = (Math.round(currheight / speed));
}
if(dist <= 1) {
dist = 1;
}
cont.style.height = currheight + (dist * cont.direction) + 'px';
cont.style.opacity = currheight / cont.maxh;
cont.style.filter = 'alpha(opacity=' + (currheight * 100 / cont.maxh) + ')';
if(currheight < 2 && cont.direction != 1) {
cont.style.display = 'none';
clearInterval(cont.timer);
} else if(currheight > (maxh - 2) && cont.direction == 1) {
clearInterval(cont.timer);
}
}Код: Выделить всё
function hide_block(show)
{
dE('hidden');
if (show && document.getElementById('hidden').style.display != 'none')
{
document.getElementsByName('hide')[0].focus();
createCookie('hidden_block', 'on', '365');
}
if (show && document.getElementById('hidden').style.display == 'none')
{
document.getElementsByName('hide')[0].focus();
createCookie('hidden_block', 'off', '365');
}
return true;
}
var cookie = readCookie("hidden_block");
var on_off = cookie ? cookie : 'on';
function init_hidden_block()
{
if (on_off == 'on')
{
dE('hidden', 1);
return true;
}
if (on_off == 'off')
{
dE('hidden', -1);
return true;
}
}
onload_functions.push('init_hidden_block();');Код: Выделить всё
<div class="forumbg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header">
<dl class="icon">
<thead>
<tr>
<th align="center">
<dt><a href="" name="hide" onclick="hide_block(true);return false;">{L_STATISTICS_BIG}</a></dt>
</th>
</tr>
</thead>
</dl>
</li>
</ul>
<div class="bg2" id="hidden" style="display: none; padding: 0.8em; font-size: 1.3em">
тут информация
</div>
<span class="corners-bottom"><span></span></span>
</div>
</div>Код: Выделить всё
<div class="forumbg">
<div class="inner"><span class="corners-top"><span></span></span>
<table class="table1" cellspacing="1">
<thead>
<tr>
<th align="center">
<a href="" name="hide" onclick="hide_block(true);return false;">{L_STATISTICS_BIG}</a>
</th>
</tr>
</thead>
<tbody>
<tr class="bg2">
<td>
тут информация
</td>
</tr>
</tbody>
</table>
</div><span class="corners-bottom"><span></span></span>
</div>Код: Выделить всё
<ul class="topiclist">
пыр пыр пыр
</ul>
Код: Выделить всё
<table class="table1" cellspacing="1">
пыр пыр пыр
</table>
Зайти вот сюда →как реализовать функцию раскрывания под стилем suvsilver2
Код: Выделить всё
Uncaught ReferenceError: readCookie is not defined
Uncaught ReferenceError: createCookie is not defined
Куда копать то?Nekstati писал(а):А чтобы список был изначально раскрыт, замените -1 на 1 в этой строке:Код: Выделить всё
dE('hidden', (readCookie('hidden_block') || -1));