Autor Zpráva
RobertH
Profil
Zdravim,

sem v JS upnej zacatecnik, ale zakaznik trva na tom, ze chce mit menu a jeho podmenu rozeviratelne viz.: http://www.novosevenrt.com/
tak jsem pouzil vlastne jiz toto hotove reseni, ale bohuzel pri nacitani mi menu zustava rozverene coz je spatne viz.: http://www.casanova.cz/novoseven/proHCP/index.html

Nevedel by jste nekdo co s tim?

Predem dekuji.
peta
Profil
RobertH
kdyz upravuji stranku, tak si ulozim celou jejich stranku, upravuji do sve podoby opatrne a po kazde zkousim. Ukladam si prubezne kazdou funkcni kopii.
Nezavidim ti to, na te strance je spoustu bince s JS.
To menu je prilis slozite i na tve strance, aby se v tom nekomu chtelo vrtat.

http://www.casanova.cz/novoseven/proHCP/menu.html
Varování: Očekáván znak ':', ale nalezeno '}'. Deklarace vynechána.
Zdrojový soubor: http://www.casanova.cz/novoseven/ui/css/menu.css
Řádek: 17
Je mozne, ze by byla chyba v CSS a on pak vlastnosti ignoroval?

window.onload=init;
Koukam, ze toto mas v nekolika JS souborech, co je propojujes. Je ti jasne, ze funkce init v souboru 3 prepisuje funkci init v souboru 2 a window.onload=init; v souboru 3 prepisuje to, co je v souboru 2?
Takze musis vsechny init prejmenovat, treba na init1 a init2 a pak vytvorit vlastni init, ktery spousti jak 1, tak 2. window.onload=init; zustane.
RobertH
Profil
No popravde moc jasny mi to neni, jelikoz s JS moc zkusenosti nemam, je to pouze stazeny ze zahranicnich stranek a ma se to pouzit na ceskou mutaci, ale je mi divny, ze kdyz jsem stahnul snad kompletne vsechno co se dalo a v kodu nic neupravoval, tak ze to najednou nefunguje.
peta
Profil
window.onload=init
kusuj, asi vlci mlha s tim init. Prisahal bych, ze jeste vcera to bylo ve dvou JS. ted je to jen v ../ui/js/novosevenrt.js"

Kazdopadne stale mas chybu v css
padding:0 0 2.3em;ba}
A plati, ze ten kod je celkem slozitej a ze se nenajde ochotnej clovek, ktery bude zkoumat, kde se co dela, jen tak :)
A tez plati, ze das jejich stranku, soubor - ulozit a upravujes, ukladas u sebe na disku. To je nejistejsi cesta, ja si zajistit funkcni verzi.

Kdyz se podivas treba do
../ui/js/novosevenrt.js
function init()
tam mas
if(document.getElementById('home-main')){var g =
if(document.getElementById('lwh-main')){var g =
if(document.getElementById('ca-residents'))
if(document.getElementById('hcp-link')){hcpLink();}
... nic, prace
Jitka27
Profil
Mám podobný problém. Potřebuju aby po načtení stránky zůstalo vše zavřené. Přikládám skript. Díky všem za pomoc. Já se v něm popravdě absolutně nevyznám.
Díííííky



var Spry;
if (!Spry) Spry = {};
if (!Spry.Widget) Spry.Widget = {};

Spry.Widget.Accordion = function(element, opts)
{
this.element = this.getElement(element);
this.defaultPanel = 0;
this.hoverClass = "AccordionPanelTabHover";
this.openClass = "AccordionPanelOpen";
this.closedClass = "AccordionPanelClosed";
this.focusedClass = "AccordionFocused";
this.enableAnimation = true;
this.enableKeyboardNavigation = true;
this.currentPanel = null;
this.animator = null;
this.hasFocus = null;

this.previousPanelKeyCode = Spry.Widget.Accordion.KEY_UP;
this.nextPanelKeyCode = Spry.Widget.Accordion.KEY_DOWN;

this.useFixedPanelHeights = true;
this.fixedPanelHeight = 0;

Spry.Widget.Accordion.setOptions(this, opts, true);

this.attachBehaviors();
};

Spry.Widget.Accordion.prototype.getElement = function(ele)
{
if (ele && typeof ele == "string")
return document.getElementById(ele);
return ele;
};

Spry.Widget.Accordion.prototype.addClassName = function(ele, className)
{
if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
return;
ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.Accordion.prototype.removeClassName = function(ele, className)
{
if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
return;
ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

Spry.Widget.Accordion.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
{
if (!optionsObj)
return;
for (var optionName in optionsObj)
{
if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
continue;
obj[optionName] = optionsObj[optionName];
}
};

Spry.Widget.Accordion.prototype.onPanelTabMouseOver = function(e, panel)
{
if (panel)
this.addClassName(this.getPanelTab(panel), this.hoverClass);
return false;
};

Spry.Widget.Accordion.prototype.onPanelTabMouseOut = function(e, panel)
{
if (panel)
this.removeClassName(this.getPanelTab(panel), this.hoverClass);
return false;
};

Spry.Widget.Accordion.prototype.openPanel = function(elementOrIndex)
{
var panelA = this.currentPanel;
var panelB;

if (typeof elementOrIndex == "number")
panelB = this.getPanels()[elementOrIndex];
else
panelB = this.getElement(elementOrIndex);

if (!panelB || panelA == panelB)
return null;

var contentA = panelA ? this.getPanelContent(panelA) : null;
var contentB = this.getPanelContent(panelB);

if (!contentB)
return null;

if (this.useFixedPanelHeights && !this.fixedPanelHeight)
this.fixedPanelHeight = (contentA.offsetHeight) ? contentA.offsetHeight : contentA.scrollHeight;

if (this.enableAnimation)
{
if (this.animator)
this.animator.stop();
this.animator = new Spry.Widget.Accordion.PanelAnimator(this, panelB, { duration: this.duration, fps: this.fps, transition: this.transition });
this.animator.start();
}
else
{
if(contentA)
{
contentA.style.display = "none";
contentA.style.height = "0px";
}
contentB.style.display = "block";
contentB.style.height = this.useFixedPanelHeights ? this.fixedPanelHeight + "px" : "auto";
}

if(panelA)
{
this.removeClassName(panelA, this.openClass);
this.addClassName(panelA, this.closedClass);
}

this.removeClassName(panelB, this.closedClass);
this.addClassName(panelB, this.openClass);

this.currentPanel = panelB;

return panelB;
};

Spry.Widget.Accordion.prototype.closePanel = function()
{
// The accordion can only ever have one panel open at any
// give time, so this method only closes the current panel.
// If the accordion is in fixed panel heights mode, this
// method does nothing.

if (!this.useFixedPanelHeights && this.currentPanel)
{
var panel = this.currentPanel;
var content = this.getPanelContent(panel);
if (content)
{
if (this.enableAnimation)
{
if (this.animator)
this.animator.stop();
this.animator = new Spry.Widget.Accordion.PanelAnimator(this, null, { duration: this.duration, fps: this.fps, transition: this.transition });
this.animator.start();
}
else
{
content.style.display = "none";
content.style.height = "0px";
}
}
this.removeClassName(panel, this.openClass);
this.addClassName(panel, this.closedClass);
this.currentPanel = null;
}
};

Spry.Widget.Accordion.prototype.openNextPanel = function()
{
return this.openPanel(this.getCurrentPanelIndex() + 1);
};

Spry.Widget.Accordion.prototype.openPreviousPanel = function()
{
return this.openPanel(this.getCurrentPanelIndex() - 1);
};

Spry.Widget.Accordion.prototype.openFirstPanel = function()
{
return this.openPanel(0);
};

Spry.Widget.Accordion.prototype.openLastPanel = function()
{
var panels = this.getPanels();
return this.openPanel(panels[panels.length - 1]);
};

Spry.Widget.Accordion.prototype.onPanelTabClick = function(e, panel)
{
if (panel != this.currentPanel)
this.openPanel(panel);
else
this.closePanel();

if (this.enableKeyboardNavigation)
this.focus();

if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
if (e.stopPropagation) e.stopPropagation();
else e.cancelBubble = true;

return false;
};

Spry.Widget.Accordion.prototype.onFocus = function(e)
{
this.hasFocus = true;
this.addClassName(this.element, this.focusedClass);
return false;
};

Spry.Widget.Accordion.prototype.onBlur = function(e)
{
this.hasFocus = false;
this.removeClassName(this.element, this.focusedClass);
return false;
};

Spry.Widget.Accordion.KEY_UP = 38;
Spry.Widget.Accordion.KEY_DOWN = 40;

Spry.Widget.Accordion.prototype.onKeyDown = function(e)
{
var key = e.keyCode;
if (!this.hasFocus || (key != this.previousPanelKeyCode && key != this.nextPanelKeyCode))
return true;

var panels = this.getPanels();
if (!panels || panels.length < 1)
return false;
var currentPanel = this.currentPanel ? this.currentPanel : panels[0];
var nextPanel = (key == this.nextPanelKeyCode) ? currentPanel.nextSibling : currentPanel.previousSibling;

while (nextPanel)
{
if (nextPanel.nodeType == 1 /* Node.ELEMENT_NODE */)
break;
nextPanel = (key == this.nextPanelKeyCode) ? nextPanel.nextSibling : nextPanel.previousSibling;
}

if (nextPanel && currentPanel != nextPanel)
this.openPanel(nextPanel);

if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
if (e.stopPropagation) e.stopPropagation();
else e.cancelBubble = true;

return false;
};

Spry.Widget.Accordion.prototype.attachPanelHandlers = function(panel)
{
if (!panel)
return;

var tab = this.getPanelTab(panel);

if (tab)
{
var self = this;
Spry.Widget.Accordion.addEventListener(tab, "click", function(e) { return self.onPanelTabClick(e, panel); }, false);
Spry.Widget.Accordion.addEventListener(tab, "mouseover", function(e) { return self.onPanelTabMouseOver(e, panel); }, false);
Spry.Widget.Accordion.addEventListener(tab, "mouseout", function(e) { return self.onPanelTabMouseOut(e, panel); }, false);
}
};

Spry.Widget.Accordion.addEventListener = function(element, eventType, handler, capture)
{
try
{
if (element.addEventListener)
element.addEventListener(eventType, handler, capture);
else if (element.attachEvent)
element.attachEvent("on" + eventType, handler);
}
catch (e) {}
};

Spry.Widget.Accordion.prototype.initPanel = function(panel, isDefault)
{
var content = this.getPanelContent(panel);
if (isDefault)
{
this.currentPanel = panel;
this.removeClassName(panel, this.closedClass);
this.addClassName(panel, this.openClass);

// Attempt to set up the height of the default panel. We don't want to
// do any dynamic panel height calculations here b

Vaše odpověď

Mohlo by se hodit

Neumíte-li správně určit příčinu chyby, vkládejte odkazy na živé ukázky.
Užíváte-li nějakou cizí knihovnu, ukažte odpovídajícím, kde jste ji vzali.

Užitečné odkazy:

Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: