body 방향이 rtl 인 경우 div의 scrollLeft 속성이 다른 브라우저에서 다른 값을 반환하는 것처럼 보입니다. 초기 값은 400이고, 왼쪽으로 스크롤 이동 때 IE8 0방향이 rtl 인 경우 jQuery.scrollLeft() - 다른 브라우저에서 다른 값
인 - - http://jsfiddle.net/auVLZ/2/
body { direction: rtl; }
div.Container { border: 5px solid #F00; width: 500px; height: 400px; overflow: auto; }
div.Content { background-color: #00F; width: 900px; height: 380px; }
<div id="divContainer" class="Container">
<div class="Content"></div>
</div>
<br />
<input id="showScrollLeft" type="button" value="Show ScrollLeft" />
$(document).ready(function()
{
$("#showScrollLeft").click(function(e)
{
alert($("div.Container").scrollLeft());
});
});
크롬 -
예는 여기에서 알 수있는 0
- 0 및 -400.
이 차이의 원인은 무엇이며 어떻게 처리 할 수 있습니까?
편집 : "일반"scrollLeft에서도 마찬가지입니다. document.getElementById("divContainer").scrollLeft
은 같은 결과를 반환합니다.
브라우저 탐지 자체가 나쁜 것은 아니다, IE이다. – jbkkd
나는 또한이 문제와 싸우고있다 .... 카나리아 고정 scrollLeft, 그러나 scrollIntoView() http://plnkr.co/edit/UZvnlq?p=info – Jason