En général, vous pouvez faire quelque chose comme ceci:
<a href="google.com"><img id="myImage" src="http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_still_zpskfsuzshi.jpg" onmouseover="this.src='http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_zpsekucjvgf.gif'" onmouseout="this.src='http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_still_zpskfsuzshi.jpg'" /></a>
<script>
var w = window.innerWidth;
document.getElementById("myImage").width = w;
</script>
Ce ajusteriez la largeur de l'image à la largeur intérieure de la fenêtre du navigateur. Si vous souhaitez ajuster en fonction de la hauteur, utilisez plutôt la propriété window.innerHeight. Vous pouvez écrire un peu de logique si vous voulez ajuster votre image par le plus petit des deux par rapport à votre image.
Ou, si vous voulez le faire en ligne:
<a href="google.com"><img src="http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_still_zpskfsuzshi.jpg" onmouseover="this.src='http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_zpsekucjvgf.gif'" onmouseout="this.src='http://i1146.photobucket.com/albums/o535/DanielleStateAuto/360_vid_033017_A_still_zpskfsuzshi.jpg'" width="window.innerWidth"/></a>
fonctionnerait aussi, mais il serait difficile d'ajouter une logique supplémentaire à elle.
Bienvenue sur stackoverflow.com! Nous faisons de notre mieux pour répondre aux questions des gens quand ils sont bien pensés et montrent des preuves de recherche et montrent le code. Veuillez lire la documentation suivante http://stackoverflow.com/help/how-to-ask, – Sethmr