I have the following HTML with CSS .container { overflow: scroll; } etc.
<body> <div class="container"> <div id="markers"></div> <img id="map" src="/img/map.jpg"/> </div> </body>
map.jpg is very large and I want to scroll to a fixed position like this:
$(function(){ console.log($('.container').scrollTop()); $('.container').scrollTop(1000); console.log($('.container').scrollTop()); console.log($('.container').scrollLeft()); $('.container').scrollLeft(1750); console.log($('.container').scrollLeft()); });
scrollLeft works fine but scrollTop doesn't. Below is the console output.
0 0 0 1750
I've been searching for half an hour but still don't know how to fix it... Anybody can help? thx :-)