Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function winnerA() {
- document.getElementById('DesactiverFonctionB').removeAttribute("onclick");
- document.getElementById('DesactiverFonctionA').removeAttribute("onclick");
- var versus = document.getElementById('contenuVersus');
- var posyStart = versus.offsetTop+80;
- var opacityStart = 0;
- if (parseInt(nombreVoteObjetA)+1 > parseInt(nombreVoteObjetB)) { //Si objet A gagne
- var posxStart = -window.innerWidth+640; //Initialise stickman à sa position de départ en X
- var posxEnd = window.innerWidth/2-400; //Initialise stickman à sa position de d'arrivée en X
- document.getElementById("gifA").style.opacity=opacityStart;//Initialise stickman a une opacité de 0 (non visible)
- document.getElementById("gifA").style.left=posxStart+"px"; //Place stickman à sa position de départ en X
- document.getElementById("gifA").style.top=posyStart+"px"; //Place stickman à sa position de départ en Y
- document.getElementById('gifA').removeAttribute("hidden"); //Affiche le à l'écran
- $('#gifA').animate({ //Lance l'annimation de stickman
- opacity: 0.99,
- left: posxEnd //Jusqu'a sa position de fin
- }, 800, 'linear'); // fais le en 3millisecondes
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- setTimeout(function () { //attends 300 millisecondes
- $('.gauche').animate({ //Déplace le background
- width: '80%' // De x % // TODO: valeur a changer par une variable
- }, 1000, 'linear'); // Fais le en 1 secondes
- }, 800);
- }else if (parseInt(nombreVoteObjetA)+1 == parseInt(nombreVoteObjetB)) {
- var posxStart = window.innerWidth/2-330;
- document.getElementById("gifA").style.opacity=opacityStart;
- document.getElementById("gifA").style.left=posxStart+"px";
- document.getElementById("gifA").style.top=posyStart+"px";
- document.getElementById('gifA').removeAttribute("hidden");
- $('#gifA').animate({
- opacity: 0.99
- }, 150);
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- }else {
- var posxStart = window.innerWidth-320;
- var posxEnd = window.innerWidth/2-260;
- document.getElementById("gifB").style.left=posxStart+"px";
- document.getElementById("gifB").style.top=posyStart+"px";
- document.getElementById('gifB').removeAttribute("hidden");
- $('#gifB').animate({
- left: posxEnd
- }, 500, 'linear');
- setTimeout(function () {
- $('.gauche').animate({
- width: '0%'
- }, 1000, 'linear');
- }, 500);
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- }
- }
- function winnerB() {
- document.getElementById('DesactiverFonctionA').removeAttribute("onclick");
- document.getElementById('DesactiverFonctionB').removeAttribute("onclick");
- var versus = document.getElementById('contenuVersus');
- var posyStart = versus.offsetTop+80;
- var opacityStart = 0;
- if (parseInt(nombreVoteObjetA) > parseInt(nombreVoteObjetB)+1) { //Si objet A gagne
- var posxStart = -window.innerWidth+640; //Initialise stickman à sa position de départ en X
- var posxEnd = window.innerWidth/2-400; //Initialise stickman à sa position de d'arrivée en X
- document.getElementById("gifA").style.opacity=opacityStart;//Initialise stickman a une opacité de 0 (non visible)
- document.getElementById("gifA").style.left=posxStart+"px"; //Place stickman à sa position de départ en X
- document.getElementById("gifA").style.top=posyStart+"px"; //Place stickman à sa position de départ en Y
- document.getElementById('gifA').removeAttribute("hidden"); //Affiche le à l'écran
- $('#gifA').animate({ //Lance l'annimation de stickman
- opacity: 0.99,
- left: posxEnd //Jusqu'a sa position de fin
- }, 800, 'linear'); // fais le en 3millisecondes
- setTimeout(function () { //attends 300 millisecondes
- $('.gauche').animate({ //Déplace le background
- width: '80%' // De x % // TODO: valeur a changer par une variable
- }, 1000, 'linear'); // Fais le en 1 secondes
- }, 800);
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- }else if (parseInt(nombreVoteObjetA) == parseInt(nombreVoteObjetB)+1) {
- var posxStart = window.innerWidth/2-330;
- document.getElementById("gifA").style.opacity=opacityStart;
- document.getElementById("gifA").style.left=posxStart+"px";
- document.getElementById("gifA").style.top=posyStart+"px";
- document.getElementById('gifA').removeAttribute("hidden");
- $('#gifA').animate({
- opacity: 0.99
- }, 150);
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- }else {
- var posxStart = window.innerWidth-320;
- var posxEnd = window.innerWidth/2-260;
- document.getElementById("gifB").style.left=posxStart+"px";
- document.getElementById("gifB").style.top=posyStart+"px";
- document.getElementById('gifB').removeAttribute("hidden");
- $('#gifB').animate({
- left: posxEnd
- }, 500, 'linear');
- setTimeout(function () {
- $('.gauche').animate({
- width: '0%'
- }, 1000, 'linear');
- }, 500);
- setTimeout(function () { //attends la fin de toutes les annimation (1800 millisecondes) et affiche le bouton prochain versus
- $('#skipNextVersus').animate({
- top: '330',
- opacity: 0.99
- }, 300);
- }, 1800);
- }
- }
- function res() {
- alert(window.innerWidth);
- }
- function myFunction() {
- var x = document.getElementById("myTopnav");
- if (x.className === "topnav") {
- x.className += " responsive";
- $('#categorie').animate({
- 'margin-top': '464',
- }, 150);
- } else {
- x.className = "topnav";
- $('#categorie').animate({
- 'margin-top': '48',
- }, 150);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement