0

i have div with max height and overflow - auto, when div size overflows scroll bar added automatically, but i set

$("#itemsdiv").scrollTop(10000); 

so that scroll bar is always at bottom . Now i want that if view is load with ajax request then scrollbar is at bottom , and if view load when page refreshing then scroll bar will at top of div. can any one help me

thank you

1 Answer 1

1
@if(Request.IsAjaxRequest())
 {
     <script>        
    //If Ajax Request Code Here
   $("#itemsdiv").scrollTop(10000);
   </script>
 }
 else
 {
    <script>//Else here
    $("#itemsdiv").scrollTop(10);
   </script>
 }

Put the Above code in your View

Sign up to request clarification or add additional context in comments.

1 Comment

thank, it works well, actually i added same if loop but in script so that it doesnt work .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.