tags:

views:

36

answers:

1

I 'm using this code to make a toogle effect at bottom of the page. it's working but toogle div going under the fold but browser do not to scroll at bottom following the toogle area

<script type="text/javascript">

jQuery.noConflict();

        jQuery(document).ready(function() {

         // toggles the slickbox on clicking the noted link 
          jQuery('a#sm_toggle').click(function() {
            jQuery('#sitemapContainer').slideToggle(400);
            return false;
          });

        });


    </script>

I want to make scroll bar responsive along with hide show div.

+1  A: 

Setting the scrollTop property of an element or window should do it:

myNode.scrollTop = 450;
window.scrollTop = 200;

Edit: how to use this in the context:

function getPosition(node) {
  var x = 0, y = 0;
  do {
    x += node.offsetLeft;
    y += node.offsetTop;
  } while (node = node.offsetParent);
  return { x: x, y: y };
}

window.scrollTop = getPosition(toggleDiv).y;
Delan Azabani
Thanks for reply - how to set this in my code?
metal-gear-solid