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
| /** POPIN **/
$j('.popinBtn').on("click", function(e){
e.preventDefault();
var _id = $j(this).attr('data-id');
$j('body').addClass('blocantiscroll');
$j('.popin#'+_id).addClass('visible');
if($j('.popin#'+_id).hasClass('popinPage')){
var _maxImg = $j('.popin#'+_id+' .image .img').length;
if(_maxImg > 1){
var _currentImg = 1;
var _idImg = $j('.popin#'+_id+' .image').attr('data-id');
$j('.popin#'+_id+' .image .img').fadeOut(0);
$j('#'+_idImg+_currentImg).stop().fadeIn(0);
timerImg = setInterval(function(){
_currentImg += 1;
if(_currentImg > _maxImg) _currentImg = 1;
$j('.popin#'+_id+' .image .img').fadeOut(500);
$j('#'+_idImg+_currentImg).delay(500).fadeIn(500);
}, 3500);
}
}
});
$j('.popin .fermer').on("click", function(e) {
e.preventDefault();
$j('body').removeClass('blocantiscroll');
$j('.popin').removeClass('visible');
clearInterval(timerImg);
}); |
Partager