bonjour,
j'ai créer un slider et je rencontre un problème que je n'arrive pas résoudre.
j'ai utiliser la fonction animate(marginLeft:XX) pour le faire défiler le problème rencontrer au retour en arrière la photo apparaissait directement sans glisser.
j'ai donc changé de fonction pour utiliser la fonction show(slide),hide(slide) le soucis que j'ai c'est que les photos apparaissent sans glissement, je voudrais le rendre plus fluide.
visible ici : http://www.larosedelorient.com/slider.php
merci
mon code suis
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
 
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
<html>
<head>
         <title>slider</title>
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         <meta http-equiv="content-type" content="text/html; charset=utf-8" />
         <style type="text/css">
 * {margin:0;padding0;}
     .photo {
 position:relative;
        width: 1170px;  
        height: 640px;
        overflow: hidden;  
 background-color:#777777;margin-left:auto;margin-right:auto;
     }  
 
     .photo ul {  
         /* nombre de photo x 100% */  
        width: 300px;  
        height: 100%;  
        padding:0; margin:0;  
        list-style: none;  
     }  
     .photo li { 
 
        float: left;  
     }  
 img.slider{margin-left:345px;margin-right:345px}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script type="text/javascript">
var numerique=2;
var chaine='k';
var identifiant=0;
var identifiant1='p';
var identifiant2='l';
var hautfenetre=640;
var largfenetre=1170;
var largmarge=345;
var largmargephoto=345;
var largphoto=480;
var couleurfond="#777777";
 if(window.innerWidth<1190){
hautfenetre=Math.round((640*(window.innerWidth-20))/1170);
largmarge=Math.round(345*((640*(window.innerWidth-20))/1170)/640);
largmargephoto=largmarge;
largfenetre=window.innerWidth-20;
largphoto=largfenetre-((345*((640*(window.innerWidth-20))/1170)/640)*2);
} 
if(largfenetre<480){
largmargephoto=0;
largphoto=largfenetre;
hautfenetre=Math.round((640*largfenetre)/480);
couleurfond="#FFFFFF";
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$(function(){  
	$(".photo").css({width:largfenetre,'background-color':couleurfond});
	$(".photo,.precsuiv").css({height:hautfenetre});
	$(".precsuiv").css({width:largmarge});
	$(".slider").css({'margin-left':largmargephoto,'margin-right':largmargephoto,width:largphoto});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       var refreshIntervalId = setInterval(function(){
if(identifiant<1 || identifiant>3){
identifiant=1;
}
numerique=identifiant;
chaine=numerique;
identifiant1=identifiant;
identifiant1=identifiant2+numerique;
 
 
 
 
if(identifiant==1){
identifiant1=identifiant2+identifiant;
}
		$("#"+identifiant1).hide("slide",{direction:"left"},500); /* li cacher */ 
identifiant=identifiant+1;
if(identifiant>3){
identifiant=1;
}
 
 
identifiant1=identifiant2+identifiant;
 
			$("#"+identifiant1).show("slide",{direction:"right"},500); /* li suivante afficher */
 
 
 
 
 
 
		/* find("li:last").after($(".photo ul").find("li:first")); */
       }, 5000); 
 
 
 
		/* $(".photo ul li").show("slide",{direction:"right"},500);} */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
          /*  $('.precsuiv').on('click', function(e) { */
         /*           e.preventDefault(e); */
         /*           clearInterval(refreshIntervalId); */     /* On arrete le setInterval */
         /*           var _width = $(this).attr('data-width'); */
         /*           $(".photo ul").animate({marginLeft: _width},800,function(){  */ 
          /*                        $(this).css({marginLeft:0}).find("li:last").after($(this).find("li:first"));  */ 
           /*         }); */
     /*  refreshIntervalId = setInterval(function(){   */
      /*     $(".photo ul").animate({marginLeft:-1170},800,function(){   */
      /*        $(this).css({marginLeft:0}).find("li:last").after($(this).find("li:first")); */
       /*    })   */
     /*   }, 5000);  */
/* }); */
    });
</script>
 
</head>
<body>
<script>document.write("Cette fen&ecirc;tre fait " +largfenetre+ " de large et "+hautfenetre+" de haut la largeur de la marge "+largmarge+" pixel");</script>
         <div id="photo" class="photo">
         <span data-width="-1170" class="precsuiv" style="background: url(images/fleche-gauche.gif) no-repeat 10px center;width:345px;height:100%;position:absolute;z-index:2;cursor:pointer;"></span>
                 <ul id="ul_photo">
                        <li id="l1"><img class="slider" src="images/costume-danse-orientale-voile-rouge-profile.jpg" title="" alt="" /></li>
                        <li id="l2"><img class="slider" src="images/costume-danse-orientale-voile-rouge-dos.jpg" title="" alt="" /></li>
                        <li id="l3"><img class="slider" src="images/costume-danse-orientale-voile-rouge.jpg" title="" alt="" /></li>
                 </ul>
         <span data-width="1170" class="precsuiv" style="background: url(images/fleche-droite.gif) no-repeat 323px center;width:345px;height:100%;position:absolute;top:0;right:0;z-index:2;cursor:pointer;"></span>
         </div>
</body>
</html>