I am wondering if there is a way to prevent this jolting to the top of the page each time that JS code is triggered. I don't want users to have to scroll back down to where they were each time they open a pop up dialogue box on my site, as this would be detrimental for usability purposes. Thanks in advance for any help I receive.
<a href='#' id="barHide">No Scrollbars</a>
document.getElementById( "barHide" ).onclick = noBars;
var x = document.body.scrollLeft + document.documentElement.scrollLeft,
y = document.body.scrollTop + document.documentElement.scrollTop;
document.getElementsByTagName( 'body' )[ 0 ].style.overflow = 'hidden';
window.scrollTo( x, y );
Gratitude acknowledged by default.