Skip to content

Instantly share code, notes, and snippets.

@cnicodeme
Last active December 10, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnicodeme/4434760 to your computer and use it in GitHub Desktop.
Save cnicodeme/4434760 to your computer and use it in GitHub Desktop.
Améliore le visuel pour la section *Autres vues du produit* sur Materiel.net
/** Testé uniquement sur Chrome et Firefox **/
jQuery(function ($) {
var isOpened = false,
imageQuantity = $('.ProdThumbnails>dl').length;
$('.ProdThumbnails')
.css({
'position': 'absolute',
'height': 145,
'width': 280,
'background-color': 'white',
'border': 'solid #fff 1px',
'border-radius': '5px',
'overflow': 'hidden'
})
.on ({
'mouseenter': function (event) {
if (isOpened || $('>dl', this).length <= 3) return;
isOpened = true;
$(this).stop(true, true).animate({
'height': 134 * ($('>dl', this).length % 3),
'border-color': '#bbb'
}, 150).find ('>div').hide();
},
'mouseleave': function (event) {
if (!isOpened) return;
isOpened = false;
$(this).stop(true, true).animate({
'height': 145,
'border-color': '#fff'
}, 150).find ('>div').show();
}
})
// L'option "indication du nombre d'images non affichées"
.append(
$('<div />').css({
'position': 'absolute',
'width': 'auto',
'bottom': 0,
'left': 0,
'right': 0,
'text-align': 'right',
'color': '#aaa',
'font-style': 'italic',
'font-size': '0.9em'
})
.text(
(imageQuantity > 3)
? ((imageQuantity - 3) + ' autres images disponibles.')
: ''
)
)
.next().css({'margin-top': 150});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment