Label er den man hele tiden kan se, hvorimod content er det der kommer frem når man trykker på pågældende label
Indsæt dette i head: <script src="java.js" type="text/javascript"></script>
og lav en fil der hedder java.js med indholdet: /* SpryAccordion.js - Revision: Spry Preview Release 1.4 */
// Copyright (c) 2006. Adobe Systems Incorporated. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Adobe Systems Incorporated nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE.
var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget = {};
// Unfortunately in some browsers like Safari, the Stylesheets our // page depends on may not have been loaded at the time we are called. // This means we have to defer attaching our behaviors until after the // onload event fires, since some of our behaviors rely on dimensions // specified in the CSS.
if (Spry.Widget.Accordion.onloadDidFire) this.attachBehaviors(); else Spry.Widget.Accordion.loadQueue.push(this); };
Spry.Widget.Accordion.prototype.attachBehaviors = function() { var panels = this.getPanels(); for (var i = 0; i < panels.length; i++) { this.initPanel(panels[i], i == this.defaultPanel); }
if (this.enableKeyboardNavigation) { // XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't // rely on adding the tabindex attribute if it is missing to enable keyboard navigation // by default.
var panels = accordion.getPanels(); for (var i = 0; i < panels.length; i++) { var p = panels[i]; var c = accordion.getPanelContent(p); if (c) { var h = c.offsetHeight; if (h == undefined) h = 0; if (p == panel || h > 0) { var obj = new Object; obj.panel = p; obj.content = c; obj.fromHeight = h; obj.toHeight = (p == panel) ? (accordion.useFixedPanelHeights ? accordion.fixedPanelHeight : c.scrollHeight) : 0; obj.increment = (obj.toHeight - obj.fromHeight) / this.steps; obj.overflow = c.style.overflow; this.panelData.push(obj);
if (this.stepCount < this.steps) this.start(); else if (this.onComplete) this.onComplete(); };
Spry.Widget.Accordion.PanelAnimator.prototype.animate = function() { var i, obj;
if (this.stepCount >= this.steps) { for (i = 0; i < this.panelData.length; i++) { obj = this.panelData[i]; if (obj.panel != this.panel) obj.content.style.height = "0px"; obj.content.style.overflow = obj.overflow; obj.content.style.height = obj.toHeight + "px"; } } else { for (i = 0; i < this.panelData.length; i++) { obj = this.panelData[i]; obj.fromHeight += obj.increment; obj.content.style.height = obj.fromHeight + "px"; } } };
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.