chris
chris

Reputation: 4867

jQuery scrollLeft in IE9

Okay, I got an div#outer with a width of 200px e.g.
In this div is another wider div, which has a width of 1200px.

To keep it simple this values are fix, in real this will be calculated.

The outer div has "overflow:scroll" so the user can scroll from left to right.
On init the inner div scrolls to a specific position.
This all works good, but why not in IE9 ?

I've made a fiddle, eventually someone has an idea whats going on in IE there.

http://jsfiddle.net/3GZYy/1/

var scrollOffset = parseInt(1255.3453 - 422.3453);

$('#outer').animate({
    scrollLeft: scrollOffset
}, 250, function() {
    // animation is over
    // createChartNavi();
});

Upvotes: 0

Views: 431

Answers (1)

Adrian Forsius
Adrian Forsius

Reputation: 1438

Your console.log is causing IE9 not to run the animation, try removing it:

$(function() {
    // Handler for .ready() called.


    // is ready
    var scrollOffset = parseInt(1255.3453 - 422.3453);

    $('#outer').animate({
        scrollLeft: scrollOffset
    }, 250, function() {
        // animation is over
        // createChartNavi();
    });
});

DEMO

Upvotes: 2

Related Questions