CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

[JS]probleme d'autoscrolling

extracasemoney
extracasemoney
Niveau 5
01 décembre 2018 à 17:19:32

j'ai un petit soucis.
J'ai crée une page vite fait, donc mon body contient 3 DIV. Chaque div à un effet de parallax et s'etend sur 100% du viewport. Maintenant, j'aimerais pouvoir gerer un autoscrolling qui permettrait de passer proprement d'une div a une autre (si possible sans jquery)

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<style>
		
		body{
			margin:0;
			padding:0;

		}

		#box1{
			height:100vh;
			width:100%;
			background-image: url(holiday.jpg);
			
			background-size:cover;
			background-attachment:fixed;
			display:table;
			position:relative;
			

			
		}

	
		#box2{
			height:100vh;
			width:100%;
			background-color:black;
			background-size:cover;
			background-attachment:fixed;
			display:table;
		
		}

		#box3{
			height:100vh;
			width:100%;
			background-image: url(sapin.jpg);
			background-size:cover;
			background-attachment:fixed;
			display:table;
		
		}

		h1{
			font-family:arial black;
			font-size:50px;
			color:white;
			margin:0px;
			text-align:center;
			display:table-cell;
			vertical-align:middle;
		   }

		
	</style>
</head>
<body>
	<div id="box1">
		<h1><a href='#'>fdfds</a></h1>
	</div>
	<div id="box2">
		<h1><a href="#">titre</a></h1>
	</div>
	<div id="box3">
		<h1>titre2</h1>
	</div>
	<script>
		var elmt = document.getElementsByTagName('a')[0];
		elmt.addEventListener('click',scrolling);

		function scrolling(){
			window.scrollTo(0,500);
		}
	</script>
</body>
</html>
Message édité le 01 décembre 2018 à 17:20:13 par extracasemoney
Sous forums
  • Aide à l'achat Mac
  • Création de Jeux
  • Linux
  • Création de sites web
  • Programmation
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment