1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
| /******************************************************************************/
/* Javascript */
/******************************************************************************/
var nav = new Array();
nav['section'] = 1;
nav['article'] = 1;
var sections = [null];
var articlesPerSection = new Array();
var currentArticle = new Array();
jQuery(document).ready(function() {
//----------------------------------
// On génere un carousel pour les
// vignettes via JCarousel
//----------------------------------
/*
jQuery('.galerie_alaune').jcarousel({
scroll: 1,
initCallback: initCarousel,
itemFirstInCallback: {
},
buttonNextHTML: null,
buttonPrevHTML: null
});
*/
//----------------------------------
// On génere les élements HTML et
// styles
//----------------------------------
jQuery('#focus_alaune').wrap('<div id="container_alaune" class="container" />');
jQuery('.container').css("float","left");
jQuery('.container').css("overflow","hidden");
jQuery('.container').css("position","relative");
jQuery('.container').css("width","510px");
jQuery('.container').css("height","250px");
jQuery('.alauneBloc').css("float","left");
jQuery('.alauneBloc').css("position","relative");
//----------------------------------
// On cherche le nombre d'articles
//----------------------------------
jQuery('#focus_alaune').each(function(){
sections.push(jQuery(this).attr('id'));
articlesPerSection[ jQuery(this).attr('id') ] = jQuery(this).children('.alauneBloc').length;
currentArticle[jQuery(this).attr('id')] = 1;
articlesPerSection.length++;
currentArticle.length++;
});
totalArticles = articlesPerSection[ sections[ nav['section'] ] ];
//----------------------------------
// On génere la taille du bloc
// conteneur en fonction du nombre
// d'articles...
//----------------------------------
for (section in articlesPerSection){
//jQuery('#' + section).width( (100 * articlesPerSection[section] ) + '%' ).height( (100 / (sections.length - 1)) + '%' );
jQuery('#' + section).width( (100 * articlesPerSection[section] ) + '%' ).height('250px' );
jQuery('#' + section).children('.alauneBloc').width( (100 / articlesPerSection[section] ) + '%' );
}
//----------------------------------
// On génere la barre de navigation
// avec les styles qui vont bien
//----------------------------------
createNav();
//----------------------------------
// On fait appel à une fonction auto
// toute les 4 secondes au chargement
//----------------------------------
autoTimer = setInterval(function(){
autoRun();
},4000);
jQuery('.nav_alaune_menu a').each(function(i){
jQuery(this).click(function(){
clearInterval(autoTimer);
jQuery('.commandes img').attr('src','typo3conf/ext/e_tca_extented/res/template/images/pictos/play.jpg');
goArticle(i);
});
});
jQuery('.survol_carousel').each(function(i){
jQuery(this).click(function(){
clearInterval(autoTimer);
jQuery('.commandes img').attr('src','typo3conf/ext/e_tca_extented/res/template/images/pictos/play.jpg');
goArticle(i);
});
});
jQuery('.commandes a').click(function(){
if(jQuery('.commandes img').attr('src') == 'typo3conf/ext/e_tca_extented/res/template/images/pictos/stop.jpg'){
clearInterval(autoTimer);
jQuery('.commandes img').attr('src','typo3conf/ext/e_tca_extented/res/template/images/pictos/play.jpg');
}else{
jQuery('.commandes img').attr('src','typo3conf/ext/e_tca_extented/res/template/images/pictos/stop.jpg');
autoTimer = setInterval(function(){
autoRun();
},6000);
}
});
});
function initCarousel(carousel) {
hoverCarousel();
};
function hoverCarousel(){
jQuery('.galerie_alaune li').each(function(iTem){
var liItem = jQuery('.galerie_alaune li:eq('+iTem+')');
var thumbItem = liItem.children("div");
liItem.hover(
function(){
thumbItem.show();
if(thumbItem.length>0){
if(thumbItem.css('display')=='none'){
thumbItem.show();
}
}
},
function(){
if(thumbItem.length>0){
if(thumbItem.css('display')=='block'){
thumbItem.hide();
}
}
}
);
iTem++;
});
}
function createNav(){
/*jQuery('.nav_alaune').appendTo('.container');*/
jQuery('#focus_alaune').css('padding','0px 0px 0px 0px');
jQuery('#focus_alaune .alauneBloc .alaune_image a').css('display','block');
jQuery('.nav_alaune').css('margin','0px 0px 0px 0px');
//jQuery('.nav_alaune_menu').appendTo('.nav_alaune');
jQuery('.nav_alaune_menu a').attr('href','javascript:void(0);');
jQuery('.commandes img').attr('src','typo3conf/ext/e_tca_extented/res/template/images/pictos/stop.jpg');
jQuery('.commandes a').attr('href','javascript:void(0);');
}
function autoRun(){
if(nav['article']>=totalArticles){
nav['article']=0;
}
goArticle(nav['article']);
}
function goArticle(cpt){
nav['article'] = cpt+1;
currentArticle[ sections[ nav['section'] ] ] = nav['article'];
contents = jQuery( '#' + sections[ nav['section'] ] );
newMargin = (-1 * (cpt) * 100) +'%';
contents.animate({'marginLeft':newMargin}, 500, 'swing');
swapClass(jQuery('.nav_alaune_menu li'),cpt,'','active');
}
function swapClass(item,pos,classOff,classOn){
item.attr('class',classOff);
item.eq(pos).attr('class',classOn);
} |
Partager