From 9f74f9ce0087b9e2406458847fb7e68863a7be2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Thu, 10 Jul 2014 15:13:29 +0200 Subject: [PATCH 1/1] =?utf8?q?Ajout=20m=C3=A9thodes=20getWindowScrollX,=20?= =?utf8?q?getWindowScrollY.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/ajax_scripts/javascript_events_api.js | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/skins/ajax_scripts/javascript_events_api.js b/skins/ajax_scripts/javascript_events_api.js index 94960c0..b4df40e 100644 --- a/skins/ajax_scripts/javascript_events_api.js +++ b/skins/ajax_scripts/javascript_events_api.js @@ -45,6 +45,8 @@ function buildMetaFunctions() { disablePropagation = _build_disablePropagation(); getWindowWidth = _build_getWindowWidth(); getWindowHeight = _build_getWindowHeight(); + getWindowScrollX = _build_getWindowScrollX(); + getWindowScrollY = _build_getWindowScrollY(); clearSelection = _build_clearSelection(); } @@ -210,6 +212,32 @@ function _build_getWindowHeight() { } } +function _build_getWindowScrollX() { + if (window.scrollX !== undefined) { + return function(){ + return window.scrollX; + }; + } + else { + return function(){ + return document.body.scrollLeft; + }; + } +} + +function _build_getWindowScrollY() { + if (window.scrollY !== undefined) { + return function(){ + return window.scrollY; + }; + } + else { + return function(){ + return document.body.scrollTop; + }; + } +} + function _build_clearSelection() { if (document.selection) { return function() { -- 2.20.1