Bonjour,
je souhaite effectuer une action assez simple en jquery (je débute) mais je n'arrive pas à la mener à bien.
Je souhaite deplacer un div sur la gauche une fois au clic puis empecher l'action de se répéter. Les recherches que j'ai fais m'ont amenés à utiliser la fonction stop cependant je n'arrive pas à la faire fonctionner.
Quelqu'un pourrait il m'aider s'il vous plait ?
Merci par avance
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 <div id="carte" style="position: absolute;" > <div class="BoxInfo2" id="BoxInfo2" style="position: absolute;margin-left:945px;margin-top:250px;z-index: 3;background-image: url(fichiers/images/cadres/actuaccueil.png);width:753px; height: 349px;"> <H2 style="margin-left:75px;margin-top:28px;"><font style="color: black;"> ACTU</font> <font style="color: white;">/ NEWS</font></H2> <p style="margin-left:160px;margin-top:10px;width:450px;color: white;font-size:18px;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis id purus mauris, et egestas velit. Phasellus egestas fermentum tincidunt. Nam a tellus pulvinar nulla gravida placerat in a lectus. Ut sagittis, mi id ullamcorper egestas, libero diam rutrum massa </p> <script> $('#carte div').on('click', function() { $('#BoxInfo2').stop().animate({ left: '-=650px' }, { queue: false, duration: 300 }); }); </script> <a href="actualite.html"> <div class="BoxInfo2" id="BoxInfo2" style="margin-left:150px;z-index: 3;width:753px; height: 349px;position: absolute; background-color: transparent;margin-top:-135px;"> </div>
Partager