J'utilise ce script pour une galerie d'images simple. Sur la dernière ligne, j'essaie de changer la bordure de l'image dans 'ceci' mais le style ne change pas pour une raison quelconque. Qu'est ce que j'ai mal fait?Modifier le style d'image enfant
$('.gallery-image').on('click',function(){
var bigCurrent = $('.hero-image').attr('src'); //the current large image src
var bigThumb = $('.hero-image').attr('data-smSrc'); //the thumb version src of the current large image
var thumbSm = $(this).attr('src'); //the currently being clicked on thumb's src
var thumbLgSrc = $(this).attr('data-lgSrc'); //the large version src of the currently being clicked on thumb
$('.hero-image').attr('src', thumbLgSrc);
$('img', this).css('border','2px solid #fff');
});
MISE À JOUR: Cela fonctionne et suit les corrections apportées dans certains commentaires ci-dessous
$('.gallery-image').on('click',function(){
var bigCurrent = $('.hero-image').attr('src'); //the current large image src
var bigThumb = $('.hero-image').attr('data-smSrc'); //the thumb version src of the current large image
var thumbSm = $('img', this).attr('src'); //the currently being clicked on thumb's src
var thumbLgSrc = $(this).attr('data-lgSrc'); //the large version src of the currently being clicked on thumb
$('.hero-image').attr('src', thumbLgSrc);
$('.selected').removeClass('selected');
$('img', this).addClass('selected');
});
pouvez-vous ajouter un violon ou un lien vers le site escroc –
Des erreurs dans la console? Ou est-ce que ça ne marche pas comme prévu? – lockedz
Désolé, le lien réel est: http://penumbralux.com/project/marisol/ – Eckstein