Merge pull request #2 from davidkethel/patch-2

Ensure div is at top/left when scroll bars removed
This commit is contained in:
Hyunje Alex Jun 2013-02-07 17:07:19 -08:00
commit 639f369d33

View File

@ -60,6 +60,7 @@
else { else {
scrollbar_x_width = 0; scrollbar_x_width = 0;
scrollbar_x_left = 0; scrollbar_x_left = 0;
$this.scrollLeft(0);
} }
if(container_height < content_height) { if(container_height < content_height) {
scrollbar_y_height = parseInt(container_height * container_height / content_height); scrollbar_y_height = parseInt(container_height * container_height / content_height);
@ -68,6 +69,7 @@
else { else {
scrollbar_y_height = 0; scrollbar_y_height = 0;
scrollbar_y_left = 0; scrollbar_y_left = 0;
$this.scrollTop(0);
} }
$scrollbar_x.css({left: scrollbar_x_left + $this.scrollLeft(), bottom: scrollbar_x_bottom - $this.scrollTop(), width: scrollbar_x_width}); $scrollbar_x.css({left: scrollbar_x_left + $this.scrollLeft(), bottom: scrollbar_x_bottom - $this.scrollTop(), width: scrollbar_x_width});