在asp按钮上单击保持滚动位置 [英] Keep Scroll position on asp button click

查看:70
本文介绍了在asp按钮上单击保持滚动位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我知道这个问题已被问过数百万次,但我得到的答案并不是我想要的,



这是我的代码

Yes, I know this question has been asked millions of times but the answers I am getting is just not what I am looking for,

This is my code

     <script>
            $("#button").click(function () {
                $('html,body').animate({
                    scrollTop: $(".second").offset().top
                },
                    'slow');
            });
    </script>





这是我的按钮



This is a my button

<button type="button" id="button">Click Me!</button>





代码效果很好但我想不使用普通的html按钮,而是使用asp按钮(我需要一个asp按钮来实现c#代码)。有没有办法让我调整代码我没有使用asp按钮?



谢谢



The code works well but I would like to instead of using a normal html button, use a asp button (I need an asp button for c# code purposes). Is there any way for me to adjust the code ive got not to work with an asp button?

Thanks

推荐答案

#button)。点击( function (){
("#button").click(function () {                


' html,body')。animate({
scrollTop:
('html,body').animate({                     scrollTop:


。second)。offset()。top
},
' slow');
});
< / script>
(".second").offset().top                 },                     'slow');             });     </script>





这是我的按钮



This is a my button

<button type="button" id="button">Click Me!</button>





代码效果很好但我想不使用普通的html按钮,而是使用asp按钮(我需要一个asp按钮来实现c#代码)。有没有办法让我调整代码我没有使用asp按钮?



谢谢



The code works well but I would like to instead of using a normal html button, use a asp button (I need an asp button for c# code purposes). Is there any way for me to adjust the code ive got not to work with an asp button?

Thanks


这篇关于在asp按钮上单击保持滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆