IE9中的jQuery scrollLeft [英] jQuery scrollLeft in IE9
问题描述
好的,我有一个宽度为200像素的div#outer,例如
在这个div中是另一个更宽的div,其宽度为1200px.
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.
外部div具有"overflow:scroll",因此用户可以从左向右滚动.
初始化时,内部div滚动到特定位置.
这一切都很好,但是为什么不能在IE9中使用?
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 ?
我做了一个小提琴,最终有人对IE中的情况有所了解.
I've made a fiddle, eventually someone has an idea whats going on in IE there.
var scrollOffset = parseInt(1255.3453 - 422.3453);
$('#outer').animate({
scrollLeft: scrollOffset
}, 250, function() {
// animation is over
// createChartNavi();
});
推荐答案
您的console.log导致IE9无法运行动画,请尝试将其删除:
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();
});
});
这篇关于IE9中的jQuery scrollLeft的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!