git-svn-id: https://192.168.0.254/svn/Proyectos.FundacionLQDVI_WebCongresos/trunk@2 94ccb1af-fd9d-d947-8d90-7f70ea60afc8
71 lines
2.3 KiB
JavaScript
71 lines
2.3 KiB
JavaScript
/**
|
|
* @version $Id: cookie.js 6138 2007-01-02 03:44:18Z eddiea $
|
|
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
|
|
* @license GNU/GPL, see LICENSE.php
|
|
* Joomla! is free software. This version may have been modified pursuant
|
|
* to the GNU General Public License, and as distributed it includes or
|
|
* is derivative of works licensed under the GNU General Public License or
|
|
* other free or open source software licenses.
|
|
* See COPYRIGHT.php for copyright notices and details.
|
|
*/
|
|
|
|
/**
|
|
* Tabs behavior
|
|
*
|
|
* @package Joomla!
|
|
* @subpackage JavaScript
|
|
* @since 1.5
|
|
*/
|
|
var JTabs = new Class({
|
|
|
|
getOptions: function(){
|
|
return {
|
|
|
|
display: 0,
|
|
|
|
onActive: function(title, description){
|
|
description.setStyle('display', 'block');
|
|
title.addClass('open').removeClass('closed');
|
|
},
|
|
|
|
onBackground: function(title, description){
|
|
description.setStyle('display', 'none');
|
|
title.addClass('closed').removeClass('open');
|
|
}
|
|
};
|
|
},
|
|
|
|
initialize: function(dlist, options){
|
|
this.dlist = $(dlist);
|
|
this.setOptions(this.getOptions(), options);
|
|
this.titles = this.dlist.getElements('dt');
|
|
this.descriptions = this.dlist.getElements('dd');
|
|
this.content = new Element('div').injectAfter(this.dlist).addClass('current');
|
|
|
|
for (var i = 0, l = this.titles.length; i < l; i++){
|
|
var title = this.titles[i];
|
|
var description = this.descriptions[i];
|
|
title.setStyle('cursor', 'pointer');
|
|
title.addEvent('click', this.display.bind(this, i));
|
|
description.injectInside(this.content);
|
|
}
|
|
|
|
if ($chk(this.options.display)) this.display(this.options.display);
|
|
|
|
if (this.options.initialize) this.options.initialize.call(this);
|
|
},
|
|
|
|
hideAllBut: function(but){
|
|
for (var i = 0, l = this.titles.length; i < l; i++){
|
|
if (i != but) this.fireEvent('onBackground', [this.titles[i], this.descriptions[i]])
|
|
}
|
|
},
|
|
|
|
display: function(i){
|
|
this.hideAllBut(i);
|
|
this.fireEvent('onActive', [this.titles[i], this.descriptions[i]])
|
|
}
|
|
});
|
|
|
|
JTabs.implement(new Events);
|
|
JTabs.implement(new Options); |