scroll position is changed when style is changed?

M

mxbrunet

When I scroll down my page and trigger js that changes a div's
visibility to 'visible' and display to 'block' the page gets
repositionned to the top (i.e. automatically scrolls to the top) and I
have to scroll back down.

How can I avoid this?
 
A

ASM

mxbrunet a écrit :
When I scroll down my page and trigger js that changes a div's
visibility to 'visible' and display to 'block' the page gets
repositionned to the top (i.e. automatically scrolls to the top) and I
have to scroll back down.

My test doesn't do what you say.

If you call your function in a link don't forget return false;

<a href="#"
onclick="fToHideShow('div_1')";
return false;">
show/hide div 1
How can I avoid this?

Example ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top