Les propriétés pageXOffset et pageYOffset retourne les positions en pixels du document actif du coin supérieur gauche de la fenêtre, horizontalement et verticalement
.....
Les propriétés pageXOffset et pageYOffset retourne les pixels du document actif a été défilée au-delà du coin supérieur gauche de la fenêtre, horizontalement et verticalement.
Les propriétés pageXOffset et pageYOffset sont égales aux propriétés scrollY et scrollX.
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Exemple pageXOffset
pageYOffset</title>
<script>
function defileFenetre()
{
window.scrollBy(100,100)
alert("pageXOffset: " + window.pageXOffset + " px, et
pageYOffset: " + window.pageYOffset+" px.")
}
</script>
<style>
input{position:fixed;top:100px;}
p{200px}
</style>
</head>
<body>
<h2>Faites redimensionner la fenêtre jusqu'à avoir les
barres de difilement horizontales</h2>
<input type="button" onclick="defileFenetre()" value="qulquez
moi pour voir le défilement" />
<p>SCROLL
SCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLLSCROLL
SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
<p>SCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL
SCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLLSCROLL SCROLLSCROLL
SCROLL SCROLL SCROLL SCROLLSCROLLSCROLLSCROLL</p>
<br><br><br><br><br><br><br><br>
</body>
</html>
Appui de navigateur
Les propriétés pageXOffset et pageYOffset sont prises en charge dans tous les principaux navigateurs.
Remarque : C'est à dire les fait 8 et les versions antérieures ne prennent en charge cette propriété, mais peut utiliser « document.body.scrollLeft » et « document.body.scrollTop » à la place.
Syntaxe
window.pageXOffset
window.pageYOffset
Livre numérique court pour comprendre la méthode secrète permettant d'obtenir des likes sans fin sur Facebook.
GAGNER DE L'ARGENT