Frage

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

War es hilfreich?

Lösung

@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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top