Move object with position of another element on the screen with clientX

0

I have the following code that is functional in IE7

function ScrollControl()
{
    var obj = window.event.srcElement;
    var evento = obj.componentFromPoint(event.clientX,event.clientY);
    window.div_cabecalho.scrollLeft = obj.scrollLeft;
}

The same code reads the movement of a table at the time of scrolling and moves the table header at the same time. The code does not work in other browsers, I tried with pageX combinations but I can not get values at the time of movement

JsFiddle

    
asked by anonymous 21.11.2014 / 20:14

1 answer

1

Fixed using jquery

$('#div_grid').on('scroll', function () {
 $('#div_cabecalho').scrollLeft($('#div_grid').scrollLeft());
});
    
24.11.2014 / 17:53