2011-03-15 6 views
1
앞에 추가가되면 내가 JQuery와 아약스() 호출

JQuery와 자동 스크롤() 성공 [방법]

success: function(html){ 
    $("ul#lists").prepend(html); 
    $("ul#lists li:first").fadeIn("slow"); 
} 

[아래 코드의 성공 부품] 후 반환 된 태그를 붙이는거야

성공, 나는 페이지가 자동으로 prepend가 일어나는 위치로 스크롤 싶어요. 구문에 대해서는 잘 모르겠지만 다음은 내가 원하는 것입니다.

success: function(html){ 
     if($("ul#lists").prepend(html)) { 
      //Scroll to the position in the page where the prepend is about to happen 
      //something similar to the href="#bookmark' in html. 
     } 
     $("ul#lists li:first").fadeIn("slow"); 
    } 

어떻게하면됩니까?

답변

3

this 플러그인을 Ariel Flesler에서 사용할 수 있습니다.

1

안녕하세요, id는 페이지를 스크롤해야하는 요소 ID입니다.

$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000); 

계속 웃어 라.