(function ($) { $.fn.clignotte = function () { $(this).animate( { "opacity" : .3 }, 1000).animate( { "opacity" : 1 }, 1000).animate( { "opacity" : .3 }, 1000).animate( { "opacity" : 1 }, 1000); }; $.fn.annoncediapo = function () { if($(".photo_annonce").length) { $image = $(".photo_annonce").attr("src"); $image = $image.replace('medium','lightbox'); $(this).css('background-image','url('+$image+')'); $(".photo_annonce").each(function () { $(this).on("click",function(){ $("#annonce_diapo").css('background-image','url(../images/load.gif)'); $image = $(this).attr("src"); $image = $image.replace('medium','lightbox'); $("#annonce_diapo").css('background-image','url('+$image+')'); }); }) } }; $.fn.closebackground = function () { $(this).on("click","#background",function () { location.reload(); }) $(this).on("click","#closerefresh",function () { location.reload(); }) }; $.fn.lieniframe = function () { return this.each(function () { $(this).on("click",function(){ $('
x
').appendTo('body'); $("#iframe").attr('src',$(this).attr('href')); return false; }); }) }; $.fn.loading = function () { return this.each(function () { if($(this).children("meta:first").length) { var $image = $(this).children("meta:first").attr('url'); $(this).css('background-image','url('+$image+')'); } }) }; $.fn.loadinghover = function () { return this.each(function () { $(this).hover(function () { if($(this).children("meta").eq(1).length) { var $image = $(this).children("meta").eq(1).attr('url'); $(this).css('background-image','url('+$image+')'); } },function () { if($(this).children("meta").eq(1).length) { var $image = $(this).children("meta:first").attr('url'); $(this).css('background-image','url('+$image+')'); } }) }) }; $.fn.popup = function () { return this.each(function () { $(this).click(function () { if($(this).parent().nextAll('.lightbox:first').length) { $(this).parent().nextAll('.lightbox:first').fadeIn('fast'); var $image = $(this).parent().nextAll('.lightbox:first').find('.telecharger').attr('href'); $(this).parent().nextAll('.lightbox:first').children('div').append(''); $(this).parent().nextAll('.lightbox:first').children('div').children('img').load(function() { $(this).parent().css("background-image", "url("+$image+")"); $(this).remove(); }); $('#navigateur').after('
'); $('#background').fadeIn('fast') } }) }) }; $.fn.popout = function () { return this.each(function () { $(this).click(function () { $(this).parent('.lightbox').fadeOut('fast'); $('#background').fadeOut('fast'); $('#background').remove() }) }) }; $.fn.popnext = function () { return this.each(function () { $(this).click(function () { if ($(this).parent().nextAll('.lightbox:first').length) { $(this).parent().fadeOut('fast'); $(this).parent().nextAll('.lightbox:first').fadeIn('fast') var $image = $(this).parent().nextAll('.lightbox:first').find('.telecharger').attr('href'); $(this).parent().nextAll('.lightbox:first').children('div').append(''); $(this).parent().nextAll('.lightbox:first').children('div').children('img').load(function() { $(this).parent().css("background-image", "url("+$image+")"); $(this).remove(); }); } else { $(this).popout() } }) }) }; $.fn.popprev = function () { return this.each(function () { $(this).click(function () { if ($(this).parent().prevAll('.lightbox:first').length) { $(this).parent().fadeOut('fast'); $(this).parent().prevAll('.lightbox:first').fadeIn('fast') var $image = $(this).parent().prevAll('.lightbox:first').find('.telecharger').attr('href'); $(this).parent().prevAll('.lightbox:first').children('div').append(''); $(this).parent().prevAll('.lightbox:first').children('div').children('img').load(function() { $(this).parent().css("background-image", "url("+$image+")"); $(this).remove(); }); } else { $(this).popout() } }) }) }; $.fn.pagination = function () { var $nbrComposants = ; $(this).append(''); var $nbrElements = 2; var $pArr = $('figure').next('article').andSelf(); var pArrLen = $pArr.length; var pPerDiv = $nbrComposants * $nbrElements; for (var i = 0; i < pArrLen; i += pPerDiv) { $pArr.filter(':eq(' + i + '),:lt(' + (i + pPerDiv) + '):gt(' + i + ')').wrapAll('
') } $nbrPage = Math.ceil(pArrLen / ($nbrComposants * $nbrElements)); if ($nbrPage > 1) { var $largeurSection = $(this).width(); $('.page_pagination').wrapAll('