0

i have a website where I hide all divs, until a user clicks on One, to show only that div. This i am able to do, but now I whenever a div is being shown, I would like to scroll down to show it (not show the div when user scrolls, but scroll to the newly displayed div).

The good news is that all divs show up at the same point, aprox 600 pixels from the top. of th e page.

I need to make it scroll smoothly!! any help or comments will be greatly appreciated.

<script type="text/javascript">
        function ShowPage(theid){ 
        var thearray= new Array("posexpress","comercio","contabilidad","produccion","marketing","reportes personalizados","reportes"); 
        for(i=0; i<thearray.length; i++){ 
        if(thearray[i] == theid){ 
            document.getElementById(theid).style.display="block";        
            var httpxml;
        } else { 
            document.getElementById(thearray[i]).style.display="none";
        }}}
    </script>
4

1 回答 1

1

试试这个。http://flesler.com/jquery/scrollTo/这是一个不错的 jQuery 插件,应该可以满足您的需求。

于 2013-06-11T20:16:25.680 回答