js: don't repeat miniscreen scrolling code

This commit is contained in:
Frédéric Péters 2018-01-09 11:58:11 +01:00
parent 59b6c57fad
commit 324240e256
1 changed files with 1 additions and 2 deletions

View File

@ -9,12 +9,11 @@ $(function() {
var $window = $(window);
var offset = parseInt(Math.random()*2000);
var $ecrans = $('.ecrans');
var pos = $window.scrollTop();
$ecrans.css('background-position', (offset + pos/2) + 'px 0px');
$window.bind('scroll', function() {
var pos = $window.scrollTop();
$ecrans.css('background-position', (offset + pos/2) + 'px 0px');
});
$window.trigger('scroll');
}
if ($('div[id|=chiffres]').length) {
var $chiffres_section = $('div[id|=chiffres]');