Subversion Repositories Sites.tela-botanica.org

Rev

Rev 657 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
634 gduche 1
onglets = new Array();
2
ongletAffiche = null;
3
 
4
$(document).ready(function() {
5
 
6
	$doc = $("#enOnglets");
7
 
8
	//1. Masquer tous les contenus SAUF le 1er
9
	$doc.children(".flux_RSS").children(".contenu_RSS").hide();
10
	$doc.children(".flux_RSS").children("h1").hide();
11
 
12
	var i= 0;
13
	$doc.children(".flux_RSS").each(function(){
14
		//On parcourt les flux RSS
15
		titre = $(this).children("h1").text();
16
 
17
		contenu = $(this).children(".contenu_RSS");
18
 
19
		onglet = new Array(titre, contenu, i);
20
		onglets[i] = onglet;
21
		i++;
22
	});
23
 
686 gduche 24
	$doc.prepend('<ul id="onglets" class="onglets"></ul>');
634 gduche 25
 
26
	//Afficher le contenu
27
	for (compteur=0; compteur < onglets.length; compteur ++)	{
28
		onglet = onglets[compteur];
686 gduche 29
		$("#onglets").append('<li class="" id="onglet-' + compteur + '" onclick="afficherContenu('+compteur+')"><h1>' + onglet[0] + "</h1></li>");
634 gduche 30
 
31
	}
32
 
33
	//afficher le premier onglet
34
	afficherContenu(0);
686 gduche 35
 
36
 
37
	/** Gestion de la taille des images
38
	 * */
39
	$(".contenu_RSS img").each(function()	{
40
		if ($(this).height() > 81)	{
41
			$(this).css("height", "81px");
42
		}
43
	});
44
 
45
 
634 gduche 46
});
47
 
48
function afficherContenu(compteur)	{
49
	if (ongletAffiche!=null) {
50
		ongletAffiche[1].hide();
686 gduche 51
		$("#onglet-" + ongletAffiche[2]).removeClass("menu_actif");
634 gduche 52
	}
53
	ongletAffiche = onglets[compteur];
686 gduche 54
	$("#onglet-" + compteur).addClass("menu_actif");
634 gduche 55
	//ajouter la classe a la liste
56
 
686 gduche 57
	if(ongletAffiche != null) {
58
		ongletAffiche[1].show();
59
	}
634 gduche 60
}
61