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
| $(document).ready(function(){
$("#boxGal").hide();
$(".galleries").click(function(){
var url = $(this).attr("href").split("&");
var elem = url[1].split("=");
var param = elem[1];
var reqUrl = "request.php"
$.get(reqUrl,{n : param}, function(data){
$("#boxGal").append(data);
$(".min").fadeOut("fast",function(){
$("#boxGal").fadeIn("slow");
});
boxGal();
s = new slider("#boxGal");
// location.reload();
//console.log(Img);
});
return false;
});
});
var slider = function(id){
self = this;
this.div = $(id); // recupere l'id de la div conteneur
this.elem = this.div.find("#boxGal_nav"); //recupere l'id de la div sur laquelle on fait slider
this.slider = this.div.find(".thumbs");
this.widthElem = this.elem.width(); //recupere la largeur de cette div
this.widthContent = 0;
this.slider.each(function(){ //on calcule sa longueur total
self.widthContent += $(this).width();
self.widthContent += parseInt($(this).css("padding-left"));
self.widthContent += parseInt($(this).css("padding-right"));
self.widthContent += parseInt($(this).css("margin-left"));
self.widthContent += parseInt($(this).css("margin-right"));
});
if (parseInt($("#boxGal_slide").css("width"))<= this.widthContent){
$("#boxGal_slide").css("width",this.widthContent+"px");
}else{
$("#boxGal_slide").css("width","5000px");
}
this.prev = this.elem.find(".previous");
this.prev.hide();
this.next = this.elem.find(".next");
this.move = this.widthElem/2;
this.nbMove = Math.ceil(this.widthContent/this.move - this.widthElem/this.move);
this.current = 0;
this.next.click(function(){
if (self.current<=self.nbMove){
self.current++;
self.slider.animate({
left : -self.current*self.move
},500);
self.prev.fadeIn(2000);
}else{
self.next.fadeOut(2000);
}
});
this.prev.click(function(){
if (self.current > 0){
self.current--;
self.slider.animate({
left : -self.current*self.move
},500);
self.next.fadeIn(2000);
}else{
self.prev.hide();
}
});
}
function boxGal(){
var windowW = $(window).width();
var windowH = $(window).height();
var contentW = "800";
var contentH = "600";
$("#boxGal_aplat").css("opacity",0.8);
$("#boxGal_slideDown").animate({
bottom : "-140px"
},500);
$("#boxGal_slideDown").mouseover(function(){
$(this).stop().animate({
bottom : "0"
},500);
});
$("#boxGal_slideDown").mouseout(function(){
$(this).stop().animate({
bottom : "-140px"
},500);
});
$("#boxGal_content").css({left:(windowW - contentW)/2+"px", top : (windowH - contentH)/2+"px",
width : contentW +"px",
height : contentH +"px"
});
$("a[rel='boxGal']").click(function(){
var name = $(this).attr("data");
var id = $(this).find("span").html();
$("#boxGal_contentBck").animate({height:"0", width:"0"},1000,function(){
$(this).empty();
$("#boxGal_contentBck").load("requestImg.php",{id:id},function(){
$(this).find("span").click(function(){
$("#boxGal").fadeOut("fast",function(){
$(this).empty();
$(".min").fadeIn("slow");
});
});
});
});
var selfW = $("#boxGal_contentBck").find("img").width();
var selfH = $("#boxGal_contentBck").find("img").height();
$("#boxGal_contentBck").animate({height:selfH+"px", width:selfW+"px"},1000);
$("#boxGal_content").css("left",(windowW - contentW)/2+"px");
$("#boxGal_content").css("top",(windowH - contentH)/2+"px");
return false;
});
$(".close").click(function(){
$("#boxGal").fadeOut("fast",function(){
$(this).empty();
$(".min").fadeIn("slow");
});
});
$("#boxGal").click(function(){
$("#boxGal").fadeOut("fast",function(){
$(this).empty();
$(".min").fadeIn("slow");
});
});
} |