IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

jQuery Discussion :

Besoin de correction dans un code


Sujet :

jQuery

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 5
    Points : 1
    Points
    1
    Par défaut Besoin de correction dans un code
    Bonjour,

    J'ai trouvé du js pour éffectuer du rollover sur des thumbnails, mais comme j'ai du mal à comprendre où éffectuer les changements pour mon site, j'espers trouvé la solution dans le forum.

    à la base, le rollover fonctionne pour le code qui suit:
    l'image par defaut sans rollover est thumb.jpg et en utilisant la classe rotating dans img ( <img "rotating" ... ), on a thumb1.jpg, thumb2, thumb3, etc...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
     
    var WIN, Rotator, pagination_offset = 0, pagination_total = 0, ratedText = "", currentResolution;
     
    function getRatingText(percent) {
    	return (percent > 80 ? 'Perfect' :
    	       percent > 60 ? 'Good' :
    	       percent > 40 ? 'Average' :
    	       percent > 20 ? 'Mediocre' :
    	                      'Lame') + ratedText;
    }
    function calculatePercent(el, mouseLeft) {
    	var width = el.width(), left = el.position().left;
    	var percent = ((mouseLeft - left) / (width) * 100);
    	if (percent > 90) percent = 100;
    	else if (percent > 80) percent = 90;
    	else if (percent > 70) percent = 80;
    	else if (percent > 60) percent = 70;
    	else if (percent > 50) percent = 60;
    	else if (percent > 40) percent = 50;
    	else if (percent > 30) percent = 40;
    	else if (percent > 20) percent = 30;
    	else if (percent > 10) percent = 20;
    	else if (percent > 0) percent = 10;
    	return percent;
    }
     
    function showMoreLess(what, hiddenText, visibleText) {
    	var link = $('#' + what + '_link');
    	what = $('#' + what);
    	if (what.css('visibility') == 'visible') {
    		what.css('visibility', 'hidden').css('display', 'none');
    		link.text(hiddenText);
    	} else {
    		what.css('visibility', 'visible').css('display', 'inline');
    		link.text(visibleText);
    	}
    	return false;
    }
     
    function VideoList(list) {
    	var dis = this;
    	var resizeWaiting = false;
     
    	var rows = list[0].className.match(/videos-([0-9]+)rows/);
    	if (!rows || !rows[1]) rows = 4;
    	else rows = parseInt(rows[1]);
     
    	var max, min = list[0].className.match(/videos-([0-9]+)to([0-9]+)/);
    	if (!min || !min[1]) {
    		max = 15;
    		min = 1;
    	} else {
    		max = parseInt(min[2]);
    		min = parseInt(min[1]);
    	}
     
    	this.resetDelayed = function(nowait) {
    		if (nowait && nowait == true) {
    			resizeWaiting = window.setTimeout(dis.reset, 500);
    		} else {
    			window.clearTimeout(resizeWaiting);
    			resizeWaiting = window.setTimeout(dis.reset, 400);
    		}
    		return dis;
    	};
     
    	this.reset = function() {
    		var listId = list[0].className.match(/videos-id([A-Za-z0-9\-\_]+)/);
    		list[0].className = list[0].className.replace(/fits[0-9 ]+/, '');
    		var firstVisible = list.children('.videoblock:visible:first');
    		var numPerRow = Math.floor(list.innerWidth() / (firstVisible.children(':first').innerWidth()+(currentResolution<=1024?3:8)));
    		if (numPerRow < min) numPerRow = min;
    		else if (numPerRow > max) numPerRow = max;
    		var paginate = true;
    		list[0].className = 'fits' + numPerRow +' '+ list[0].className.replace(/fits[0-9 ]+/, '');
     
    		if (listId && listId[1]) {
    			listId = listId[1];
    			var fits = $.cookie('fits');
    			if (!fits)
    				fits = '';
    			else
    				fits += '&';
    			fits = fits.replace(new RegExp('&?videos-id' + listId + '=[0-9]+'), '') + 'videos-id' + listId + '=' + numPerRow;
    			$.cookie('fits', fits);
    		}
     
    		var isPaged = list.hasClass('videos-paged'), videosPage = 1, videosPages = 1;
    		var videoblocks = list.children('.videoblock');
    		if (isPaged) {
    			videosPage = parseInt(list.data('page'));
    			videosPages = Math.floor(videoblocks.length / (numPerRow * rows)); // FLOOR will return only the number of "full" pages
    			if (isNaN(videosPage)) {
    				videosPage = 1;
    				var paginate_videos = function() {
    					var match = parseInt(this.href.match(/[\-\+0-9]+$/));
    					var pages = list.data('pages');
    					var page = list.data('page');
    					var newPage = page + match;
     
    					if (newPage < 1)
    						newPage = pages;
    					else if (newPage > pages)
    						newPage = 1;
     
    					list.data('page', newPage);
    					dis.reset();
     
    					return false;
    				};
    				$(document.createElement('a')).addClass('video-paginate-prev').attr('href', '-1').click(paginate_videos).insertBefore(list.parent());
    				$(document.createElement('a')).addClass('video-paginate-next').attr('href', '+1').click(paginate_videos).insertAfter(list.parent());
    			}
     
    			list.data('pages', videosPages);
    			list.data('page', videosPage);
    		}
     
    		videoblocks.slice(0, (numPerRow * rows) * (videosPage - 1)).css('display', 'none');
    		videoblocks.slice((numPerRow * rows) * (videosPage), videoblocks.length - 1).css('display', 'none');
    		videoblocks.css('display', 'none');
    		videoblocks.slice((numPerRow * rows) * (videosPage - 1), (numPerRow * rows) * (videosPage)).css('display', 'block');
     
     
    		var curPerPage = $('.videos-pagination li.videoblock:visible');
    		if (!curPerPage[0]) {
    			curPerPage = list.find('li.videoblock:visible')
    			paginate = false;
    		}
    		curPerPage = curPerPage.length;
    		var hrefPage = document.location.href.match(/page=([0-9]+)/);
    		    hrefPage = hrefPage && hrefPage[1] ? parseInt(hrefPage[1]) : 1;
     
    		var paginationList = $('ul.pagination');
    		var paginationItems = paginationList.children();
     
    		if (paginate && paginationItems[0]) {
    			var exampleLink = paginationList.find('a')[0].href.replace(/((&amp;)|\?|&)(page|offset)=[0-9]+/ig, '');
    			var startQ = (exampleLink.indexOf('?') > -1 ? '&' : '?');
     
    			paginationItems.remove();
    		}
     
    		var startFrom = 1, endAt = 10;
    		var curPage = Math.floor(pagination_offset / curPerPage)+1;
    		var pageCount = Math.ceil(pagination_total / curPerPage);
     
    		if (paginate && paginationItems[0]) {
    			var addLinks = '';
    			if (pageCount <= endAt) {
    				endAt = pageCount;
    			} else if (curPage > 6) {
    				addLinks += '<li><a href="' + exampleLink + startQ + 'offset=' + 0 /*+ '&page=' + 1*/ + '">First</a></li>';
     
    				if (curPage > pageCount-4) {
    					startFrom = pageCount - 9;
    					endAt = pageCount;
    				} else {
    					startFrom = curPage - 5;
    					endAt = curPage + 4;
    				}
    			}
    			if (pagination_offset > 1) {
    				addLinks += '<li><a href="' + exampleLink + startQ + 'offset=' + ((curPage-2)*curPerPage < 0 ? 0 : (curPage-2)*curPerPage) /*+ '&page=' + (curPage-1 < 1 ? 1 : curPage-1)*/ + '">&lt;&lt;</a></li>';
    			}
    			for (var i = startFrom; i <= endAt; i++) {
    				if (i != curPage)
    					addLinks += '<li><a href="' + exampleLink + startQ + 'offset=' + ((i-1)*curPerPage) /*+ '&page=' + (i)*/ + '">'+ i +'</a></li>';
    				else
    					addLinks += '<li class="active">'+ i +'</li>';
    			}
    			if (curPage < pageCount) {
    				addLinks += '<li><a href="' + exampleLink + startQ + 'offset=' + ((curPage)*curPerPage) /*+ '&page=' + (curPage+1)*/ + '">&gt;&gt;</a></li>';
    			}
    			if (curPage < pageCount-4) {
    				addLinks += '<li><a href="' + exampleLink + startQ + 'offset=' + (pageCount*curPerPage-curPerPage) /*+ '&page=' + (pageCount)*/ + '">Last</a></li>';
    			}
     
    			$(addLinks).appendTo(paginationList);
    		}
     
    		list.parents('div.block:first').find('.results-end-offset:first').text((pagination_offset + curPerPage) > pagination_total ? pagination_total : (pagination_offset + curPerPage));
     
    		return dis;
    	};
     
    	list.addClass('_VideoList');
    	list.data('VideoList', this);
     
    	return this;
    }
     
    function handleResolution() {
    	var winWidth = WIN.width();
    	var resolutions = [1920, 1680, 1280, 1024, 780, 640];
    	var lastSize = resolutions[0], lastDist = 9000;
    	for (var i = 0; resolutions[i]; i++) {
    		var newDist = Math.abs(resolutions[i] - winWidth);
    		if (lastDist < newDist)
    			break;
    		lastDist = newDist;
    		lastSize = resolutions[i];
    	}
    	var body = document.getElementsByTagName('body')[0];
    	if (!currentResolution || !(new RegExp('resolution'+lastSize).test(body.className))) {
    		currentResolution = lastSize;
    		body.className = body.className.replace(/ *resolution[0-9]+/, '') + ' resolution'+lastSize;
    		$.cookie('window_size', lastSize, { path: '/', expires: 30 });
    	}
    	$('._VideoList').each(function() { $(this).data('VideoList').resetDelayed(); });
    }
     
    function KEEEEEEZ() {
    	WIN = $(window);
     
    	handleResolution();
    	WIN.resize(handleResolution);
    	$('.videos').each(function() {
    		new VideoList($(this)).resetDelayed(true);
    	});
     
     
    	Rotator = {
    		el: false,
    		duration: false,
    		loader: new Image(),
    		id: 1,
    		title: '',
    		max: 16,
    		delay: 350,
    		length: 0,
     
    		prepare: function() {
    			var el = $(this).children('img:first');
    			if (el.data('timeout')) return false;
    			el.data('oldsrc', el[0].src);
    			el.data('newsrc', el[0].src.match(/^(.*[a-z]+)[0-9]*(\.[a-z]{2,4}.*)$/));
    			Rotator.title = el[0].parentNode.title;
    			el[0].alt = el[0].parentNode.title = '';
    			Rotator.id = 1;
    			Rotator.el = el;
    			Rotator.duration = el.parent().find('.duration');
    			Rotator.length = Rotator.duration.text().split(':');
    			Rotator.length = parseInt(Rotator.length[0]) * 60 + parseInt(Rotator.length[1]);
    			Rotator.swap();
    		},
     
    		stop: function() {
    			try {
    				window.clearTimeout(Rotator.el.data('timeout'));
    				Rotator.el[0].alt = Rotator.el[0].parentNode.title = Rotator.title;
    				Rotator.el[0].src = Rotator.el.data('oldsrc');
    				Rotator.duration.text(Math.floor(Rotator.length/60) + ":" + (Rotator.length % 60 >= 10 ? '' : '0') + (Rotator.length % 60));
    				Rotator.el.removeData('oldsrc');
    				Rotator.el.removeData('newsrc');
    				Rotator.el.removeData('timeout');
    				Rotator.el = false;
    				Rotator.duration = false;
    			} catch(e) {}
    		},
     
    		swap: function() {
    			try {
    				if (Rotator.id > Rotator.max) Rotator.id = 1;
    				var newsrc = Rotator.el.data('newsrc');
    				Rotator.loader.onload = Rotator.change;
    				Rotator.loader.src = newsrc[1] + Rotator.id + newsrc[2];
    				if (Rotator.loader.loaded)
    					Rotator.change();
    			} catch(e) {}
    		},
     
    		change: function() {
    			try {
    				// Prevent simultaneous multi image loading
    				if (parseInt(Rotator.loader.src.match(/^.*[a-z]+([0-9]*)\.[a-z]{2,4}.*$/)[1]) != Rotator.id) return false;
    				Rotator.el[0].src = Rotator.loader.src;
    				Rotator.duration.text(Math.floor(Rotator.length/Rotator.max*(Rotator.id-1)/60) + ":" + (Math.floor(Rotator.length/Rotator.max*(Rotator.id-1) % 60) >= 10 ? '' : '0') + Math.floor(Rotator.length/Rotator.max*(Rotator.id-1) % 60) + " / " + Math.floor(Rotator.length/60) + ":" + (Rotator.length % 60 >= 10 ? '' : '0') + (Rotator.length % 60));
    				Rotator.id++;
    				window.clearTimeout(Rotator.el.data('timeout'));
    				Rotator.el.data('timeout', window.setTimeout(Rotator.swap, Rotator.delay));
    			} catch(e) {}
    		}
    	};
     
    	$('img.rotating').each(function() {
    		var el = $(this);
    		el.parent().mouseenter(Rotator.prepare);
    		el.parent().mouseleave(Rotator.stop);
    	});
     
    	function toggleAdvancedSearch() {
    		var el = $('#search_pane');
    		if (el.css('display') != 'block') {
    			el.css('opacity', 0).css('display', 'block').fadeTo(500, 1);
    		} else {
    			el.css('opacity', 1).fadeTo(500, 0, function(){$(this).css('display', 'none');});
    		}
    		return false;
    	}
    	$('#adv-search-close').click(toggleAdvancedSearch);
    	$('#header .search-advanced a').click(toggleAdvancedSearch);
     
    	$('#search_form').submit(function() {
    		var field = $(this).find('input[name=search]');
    		if (field[0].value == '' || field[0].value == "Search...")
    			return false;
    	});
     
    	$('.featuredclick').click(function() {
    		var to = this.href.match(/#[a-zA-Z0-9\-\_]+/); to = to[0];
    		var el = $(this).parent();
    		var next  = $(to);
    		var first = el.parent().children(':first');
    		var wrap  = el.parents('.featuredcats:first');
    		var firstOff   = first.offset();
    		var currentOff = el.offset();
    		var nextOff    = next.offset();
     
    		wrap.animate({
    			scrollLeft: (nextOff.left-firstOff.left)
    		}, 500);
     
    		return false;
    	});
    }
     
    function Rater(el, submit_url, video_id) {
    	var dis = this, rating = 0;
     
    	var first = el.children(':first');
    	var next = el.next(':first');
    	if (!next.hasClass('ratingtext'))
    		next = false;
     
    	this.rate = function(percent) {
    		ratedText =  " <small>Saving...</small>";
    		next.html(getRatingText(rating));
    		rating = percent;
    		$.post(submit_url, { id: video_id, value: (percent / 100 * 5) }, dis.rateCallback);
    	};
    	this.rateCallback = function(data) {
    		el.addClass('voted');
    		$.data(el[0], 'ratingWidth', rating);
    		first.css('width', rating + '%');
     
    		if (next) {
    			if (data == "success")
    				ratedText =  " <small>(Rated: " + (''+(rating / 100 * 5)).replace(/\.5/, '&frac12;') + ")</small>";
    			else
    				ratedText =  " <small>Error registering your vote.</small>";
    			next.html(getRatingText(rating));
    		}
    	};
     
    	$.data(el[0], 'ratingWidth', parseFloat(first.css('width')));
     
    	el.mousemove(function(e) {
    		window.clearTimeout(dis.ratingRemove);
     
    		var percent = calculatePercent(el, e.pageX);
    		first.css('width', percent + '%');
     
    		if (next) {
    			next.html(getRatingText(percent));
    		}
    	});
    	el.mouseleave(function() {
    		dis.ratingRemove = window.setTimeout(function() {
    			var percent = $.data(el[0], 'ratingWidth');
    			first.css('width', percent + '%');
     
    			if (next) {
    				next.html(getRatingText(parseFloat(percent)));
    			}
    		}, 500);
    	});
    	el.click(function(e) {
    		window.clearTimeout(dis.ratingRemove);
    		dis.rate(calculatePercent(el, e.pageX));
     
    		return false;
    	});
     
    	return this;
    }
     
     
    $(document).ready(KEEEEEEZ);
    dans le cas de mon site, l'image par defaut sans rollover est thumb-1.jpg, avec le rollover j'aimerai que ca donne thumb-2.jpg, thumb-3, etc... ca ne peux fonctionner évidemment sans toucher au code original.

    Nb: je suis complètement perdu en javascript.

    Merci

  2. #2
    Membre du Club
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Novembre 2009
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Novembre 2009
    Messages : 35
    Points : 43
    Points
    43
    Par défaut
    Salut,

    Où a tu récupérer ce code ? Il doit y avoir une explication de comment l'utiliser. Il doit falloir définir une balise parente, avec un attribut title.
    Déjà, as tu bien mit :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <img src="tonImage" class="rotating" />

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 5
    Points : 1
    Points
    1
    Par défaut re
    oui, j'ai fait ce que tu m'a proposé. Il ne se passe rien

    peut etre qu'il faudrait voir au niveau des expressions régulières et faire la modification.

    j'ai fait comme suit:

    <img src="thumb-1.jpg" class="rotating">

  4. #4
    Membre du Club
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Novembre 2009
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Novembre 2009
    Messages : 35
    Points : 43
    Points
    43
    Par défaut
    J'ai l'impression qu'il faut définir le titre que tu veux voir apparaitre au moment du rollover dans l'attribut title de la balise img (j'en profite pour rajouter l'attribut alt qui est obligatoire et qui permet de définir le text qui s'affichera si l'image n'est pas dispo) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <img src="thumb-1.jpg" class="rotating" title="titre" alt="textAlternatif">
    Mais ca ne suffira pas, dans le code il faut qu'il y ait un élément possédant la classe "first" et la classe "duration" ...
    Bref je ne peux deviner comment marche ce code si tu n'a pas un exemple d'un site ou il est utilisé ou si tu ne me montre pas l'endroit ou tu l'as trouvé !!

    PS: je vois que le code utilise JQuery, tu inclus bien JQuery dans tes fichiers javascript ?

  5. #5
    Nouveau Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 5
    Points : 1
    Points
    1
    Par défaut re
    oui j'ai inclus le tout dernier jquery.

    voilà un url pour exemple:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    http://keezmovies.com

  6. #6
    Membre du Club
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Novembre 2009
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Novembre 2009
    Messages : 35
    Points : 43
    Points
    43
    Par défaut
    Ok j'ai réussi a le faire marcher chez moi.

    J'ai aussi télécharger le dernier JQuery, mais ca ne marchait pas car le site en question utilise un plugin de jquery. Donc j'ai directement récuperer leur fichier keez.js et JQuery.js sur leur site (http://www.keezmovies.com/inc/v3/js/...crollto-min.js).

    Tu met dans un dossier tous les fichiers suivant :
    jquery.1.3.2-flash-cookie-scrollto-min.js
    keez.js
    index.php
    small.jpg
    small1.jpg
    small2.jpg
    ...
    small16.jpg

    16 est la valeur maximum d'image par défaut ( tu peux modifier cette valeur dans le code de keez.js "max: 16," )

    Et dans ton fichier index.php tu met :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
     
    <html>
    <head>
    	<title>Bienvenue</title>
     
    	<script type="text/javascript" src="jquery-1.3.2.min.keez.js"></script>
    	<script type="text/javascript" src="keez.js"></script>
     
    </head>
    <body>
     
     
    <a href="tonLien" class="img" title="Le titre de la vidéo">
    			<img src="small.jpg" alt="Le titre de la vidéo" class="rotating" />
    						<var class="duration">1:25</var>
    </a>
     
    </body>
    </html>
    Par contre, tu va voir apparaitre la "duration" en dessous de l'image, sans aucun style, donc si tu veux récupérer aussi le style du site, tu doit récupérer le css du site.

    Et voila ça devrait marcher...

    PS: Sur le site il y a "small.jpg?cache_controle=x" => c'est pour éviter que les images soit sauvegarder en cache (l'url des image change tout le temps grace au parametre cache_controle donc les image ne seront pas sauvegarder dans le cache). Tu peux faire la meme chose si tu veux avec par exemple "small.jpg?cache_controle=<?php time()?>".

  7. #7
    Nouveau Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 5
    Points : 1
    Points
    1
    Par défaut re::
    Merci gobygola
    tu as très bien détaillé, en plus j'ai pas vu qu'il y avait encore deux fichier js qui me manquait .

    Mes images sont de la forme 2009-11-31-Un-Exemple-1.jpg (image principale)
    Puis 2009-11-31-Un-Exemple-2.jpg, 2009-11-31-Un-Exemple-3.jpg ainsi de suite.
    saurait-tu comment faire?
    j'ai entendu parler d'expressions régulières, peut etre qu'il faudrait apporter des modifications de ce coté.

  8. #8
    Membre du Club
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Novembre 2009
    Messages
    35
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Novembre 2009
    Messages : 35
    Points : 43
    Points
    43
    Par défaut
    Il suffit de remplacer (dans le contenu du fichier index.php que je t'ai mit dans mon poste précédent) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <img src="small.jpg" ...
    par :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <img src="2009-11-31-Un-Exemple-.jpg" ...
    Pas besoin de modifier le code js. En fait, le nom que tu met dans l'attribut "src" de la balise img, c'est un peu comme un paramètre qui dit par quoi commence le nom de tes images a afficher. Le script s'occupe après de rajouter un 1, 2, 3... (jusqu'a 16 par defaut)

  9. #9
    Nouveau Candidat au Club
    Inscrit en
    Novembre 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Novembre 2009
    Messages : 5
    Points : 1
    Points
    1
    Par défaut re:::
    je vais éssayer comme tu me le dis et je te tiens au courant

Discussions similaires

  1. [AC-2010] Besoin d'aide dans les codes pour création de formulaire_novice
    Par Melina_2 dans le forum IHM
    Réponses: 3
    Dernier message: 26/03/2014, 10h39
  2. Réponses: 1
    Dernier message: 07/11/2011, 14h35
  3. Comment interpreter correctement la balise < dans mon code jsp ?
    Par Battosaiii dans le forum Servlets/JSP
    Réponses: 3
    Dernier message: 07/11/2011, 14h27
  4. Correction d'une erreur dans un code java
    Par tvcinq dans le forum Eclipse Java
    Réponses: 0
    Dernier message: 13/01/2010, 09h30
  5. Réponses: 5
    Dernier message: 15/01/2007, 11h39

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo