PDA

View Full Version : jquery: a bug in safari and chrome - css({overflow:'auto'})


lauthiamkok
08-04-2009, 12:44 PM
Hi,
I set the body tag to overflow:hidden when the page is ready.
$('body').css({overflow:'hidden'});

and i try to set the overflow to 'auto' when the 'show more' is clicked.
$('body').css({overflow:'auto'});

it works fine in firefox and IE 8. but it wont work on safari and chrome - show the scroll bar when the show more' is clicked.

it only works in safari and chrome if I set it to,
$('body').css({overflowY:'scroll'});

but i only want to show the scroll when there are content is overflowed only.

how can i fix this browser bugs?

here are the links to look at,
http://lauthiamkok.net/tmp/projects/part/
view-source:http://lauthiamkok.net/tmp/projects/part/js/core.js

many thanks,
Lau

Iszak
08-05-2009, 04:22 AM
I do not have the problem you specify, when there is overflow: auto; set to the body but does not overflow Google Chrome does not show the scroll bar, only until there is overflow does it show.

Although I do notice that when you set overflow: hidden; in Google Chrome it set two properties (overflow-x and overflow-y) as opposed to simply overflow which may be jQuery or simply how it manipulates overflow. As seen here (www.grabup.com/uploads/c20a340123fe.png)

I should also mention this really isn't a bug.