Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript sliding menus not working
    primarykey
    data
    text
    <p>This javascript sliding menu is NOT working--the only error that debugger gives is that the first IF statement is a block command &amp; should have curly braces, which I don't understand.</p> <p>Does anyone see an obvious error? I'm not sure I'm using 'this' keyword correctly( as well as the variable slideList inside the function showSlide...please help &amp; any feedback on my formatting (white-space) is appreciated as well! </p> <pre><code>window.onload = makeMenus; var currentSlide = null; var timeID = null; var leftPos = 0; function makeMenus() { var slideMenus = new Array(); var allElems = document.getElementsByTagName("*"); for (var i = 0; i &lt; allElems.length; i++) { if (allElems[i].className == "slideMenus") menus.push(allElems[i]); } for (var i = 0; i &lt; slideMenus.length; i++) { slideMenus[i].onclick = showSlide; slideMenus[i].ul.style.left = "0px"; //for each object in slideMenus Array, ref 1st ul element within that object and set the value of the ul elements left style property to 0px } document.getElementById("head").onclick = closeSlide; document.getElementById("main").onclick = closeSlide; } function showSlide() { var slideList = this.id + ".ul[0]"; //stores object ref to the 1st ul element nested within the current object. if (currentSlide !== null) { closeSlide(); } else { closeSlide(); currentSlide = slideList; currentSlide.style.display = "block"; timeID = setInterval("moveSlide()", 1); } } function closeSlide() { if (currentSlide !== null) { clearInterval(timeID); currentSlide.style.left = "0px"; currentSlide.style.display = "none"; currentSlide = null; } } function moveSlide() { if ((leftPos + 5) &lt;= 220) { currentSlide.style.left = leftPos + "px" } else { clearInterval(timeID); leftPos = 0; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload