Salve a tutti, sto scrivendo un sito mio, vorrei creare due bottoni che diano l'input destra-sinistra a delle transizioni css e che cambino link allo stesso tempo....ho spulciato qua e la per la rete, non avendo molte nozioni tecniche in javascript, e mi sono bloccato
non riesco a capire come dare più di due input tramite javascript....
la prima e seconda la fa senza problemi, però se ne aggiungo altre, si blocca...poi credo che per assegnare un link diverso al div ad ogni click si usi lo stesso sistema....credo...codice:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Prova</title> </head> <body> <div class="transition0" id="animation"></div> <button onclick="toggle()">Click</button> <style> #animation { background-color:#ff0000; width:100px; height:100px; -webkit-transition:0.5s ease all; -webkit-transform:width:10px ; -moz-transition:0.5s ease all; -moz-transform:width:10px ; -o-transition:0.5s ease all; -o-transform:width:10px ; -ms-transition:0.5s ease all; -ms-transform:width:10px; transition:0.5s ease all; transform:width:10px ;; } #animation.transition1 { background-color:#e6a529; width:200px; height:100px; } #animation.transition2 { background-color:#ffeb00; width:400px; height:100px; } #animation.transition3 { background-color:#000aff; width:600px; height:100px; } #animation.transition4 { background-color:#00ff31; width:800px; height:100px; } </style> <script> function toggle() { var animation=document.getElementById("animation"); animation.className=animation.className=="transition0" ? "transition1" : "transition2" ; "transition3" ; "transition4" ; } </script> </body> </html>![]()