.  

 

 

.
.

26 / 05 / 2017

Usuarios conectados: 2

Cargando documento...

Buscar:

.

Este Sitio:

Principal

Dreamweaver

Fireworks

JavaScript

CSS

Sonido

Artículos

Links

E-ufemismos

Descargas

Historial

 

Mailing List:

Suscríbete a la lista de correo, No practico spamming y ofrece algunas ventajas.

Pulsa aquí para saber más y suscribirte.

 

Recomendados:

Tecnorama >JavaScript

 

Extending Spry's Accordion Widget

Versión para imprimir | Translate this page

Recently I found myself in the need to create a Spry accordion that whould hide panels on user’s request.

Spry won't add this feature by default, so it was time to add it. And it's really easy (I love Spry!):

Here are the three methdos I created:

getDisplay(element): You won’t need to use it by default. It simply receives an element and tells the value for the style.display property. However, it´s used by the other 2 methods:

Spry.Widget.Accordion.prototype.getDisplay = function(ele){
 if( ele ) return ele.style.display;
}

 

hideActivePanel(): it will hide the currently open panel. it´s content is not destroyed. to use it, simply call: yourAccordionName.hideActivelPanel()

Spry.Widget.Accordion.prototype.hideActivePanel = function(){
 var tabToHide=this.getPanelTab(this.getCurrentPanel());
 var contentToHide=this.getPanelContent(this.getCurrentPanel());
 var curPanelIndex=this.getCurrentPanelIndex();
 var nextPanelIndex=this.getCurrentPanelIndex()+1;
 this.setDisplay(tabToHide,'none');
 this.setDisplay(contentToHide,'none');
 for(i=nextPanelIndex;i<this.getPanels().length;i++){
  if(this.getDisplay(this.getPanelTab(this.getPanels()[i]))!='none'){
   this.openPanel(this.getPanels()[i]);
   return;
  }
 }
 for(i=curPanelIndex;i>=0;i--){
  if(this.getDisplay(this.getPanelTab(this.getPanels()[i]))!='none'){
   this.openPanel(this.getPanels()[i]);
   return;
  }
 }
}

 

showAllPanels(): This method will show all the panels that are hidden. To use is, call yourAccordionName.showAllPanels()

Spry.Widget.Accordion.prototype.showAllPanels = function(){
 for(i=0;i<this.getPanels().length;i++){
  var curPanel=this.getPanelTab(this.getPanels()[i]);
  if(this.getDisplay(curPanel)=='none') this.setDisplay(curPanel,'block');
 }
 var panelContent=this.getPanelContent(this.getCurrentPanel());
 this.setDisplay(panelContent,'block');
}

 

You can see a demo here

Also, you can see the whole js file here

¿Comentarios? 14, de momento. Mostrando 1 ->5

1.- study to this [url=http://onlinecasinos-x.com/]online casino[/url] where you can collect legitimate money with the help of this enchiridionPlaying [url=http://onlinecasinos-x.com/free-casino-bonus.html]online casino bonus[/url] , check this [url=http://onlinecasino-b.com/Nederland/]casino[/url]

2.- miraculous website! snip mistaken in up the wonderful work. visit my website only if you are overwhelming 21 check this [url=http://www.sextoysfun.net/]adult toys[/url] portal, [url=http://randomsend.com/]email server[/url] , buy [url=http://esextoyfun.com/c.html?c=22/]Dildos[/url]

3.- thanks due to the fact that this significant revealing website, finance up the momentous position check out this [url=http://onlinecasinos-x.com]casino online[/url] offers , buy [url=http://avi.vg]sex toys[/url]

4.- block ended this [url=http://onlinecasino-xx.com]online casino[/url] where you can conquer legitimate notes with the serve of this guidebookPlaying [url=http://onlinecasinos-x.com/online-blackjack.html]blackjack online[/url] , buy [url=http://adultsrus.us]sex toys[/url]

5.- agree ended this [url=http://onlinecasino-xx.com]casino[/url] where you can prevail in legitimate notes with the avoid of this guidePlaying [url=http://onlinecasinos-x.com/bitcoin-casino.html]bitcoin casino[/url] , buy [url=http://esextoyfun.com]sex toys[/url]

« Previous | 1 - 5 | 6 - 10 | 11 - 14 | Next »

Añade tu comentario



Escribe el código de la imagen superior:

:

TECNORAMA es simplemente una página personal. No sirve ni de promoción del autor ni cosas por el estilo.
Todos los códigos, textos y tutoriales son de libre uso mientras se mencione al autor (no es mucho pedir)
Este sitio es compatible con IE6/NS6/Mozilla1.0
Para contactar, puedes enviarme un e-mail a tecnorama@hotmail.com