$(document).ready(function() {
var speed = 40;
var lastScrollTop = 0;
var offst = $('.block2')
// higher variation = faster acceleration
function positon(variation) {
newPosition = (scrollPercent * (speed * variation)) - (speed * variation);
return newPosition + "%";
}
$(window).scroll(function(e) {
var scrollNum = $(window).scrollTop();
scrollPercent = $(window).scrollTop() / ($(document).height() - $(window).height());
var ofst = $('.block4').offset();
if (scrollNum > lastScrollTop) {
// downscroll
$('.bojler3').offset(function(i, coord){
var newCoord = {};
newCoord.top = coord.top + 0;
newCoord.left = coord.left + 25;
return newCoord;
});
$('.bojler4').css({left:479})
} else {
//upscroll
$('.bojler3').offset(function(i, coord){
var newCoord = {};
newCoord.top = coord.top + 0;
newCoord.left = coord.left - 15;
return newCoord;
});
$('.bojler4').css({left:282})
}
lastScrollTop = scrollNum;
});
});