2012-06-27 1 views
0

jQuery 라이브러리를 v1.3.2에서 1.7.2로 업데이트했습니다.이 스크립트 만 (endless_page.js) 수정해야 할 모든 것입니다. 나는 이것에서 synstax가 depreciated 또는 무엇인가 추측하고있다. 그러나 어떤 도움이라도 많이 평가 될 것이다! !!jquery_1.7.2와 작동하도록 업그레이드 스크립트

var currentPage = 1; 
var path = window.location.pathname; 
var ajax_path; 

function checkScroll() { 
    if (nearBottomOfPage()) { 
    call_ajax(); 
} else { 
    setTimeout("checkScroll()", 100); 
} 
} 

function call_ajax() { 

    $("#loading-or-more").fadeOut(100, function() { 
    $(this).replaceWith('<p class="headline" id="loading-or-more" style="display:none;text-align:center;margin-left:20px;"><img src="../../images/newlajaxoader.gif" style="float:left;margin-top:-10px;" > 10 more items on the way</p>'); 
    $("#loading-or-more").fadeIn(10); 
    }); 
    currentPage ++; 
    ajax_path = full_path(currentPage); 
    $.ajax({ 
    url: ajax_path , 
    success: function(data) { 

     if (data=="false") { 
      $("#loading-or-more").replaceWith('<p class="headline" id="end-of-scroll" style="display:none;text-align:center;"> <a href="#" class="submit gradientBGRed morecategories"> Back to top &uarr; </a> </p>'); 
      $("#end-of-scroll").fadeIn(10); 
      } 
     else { 
       $(".mb-lot-items").append(data); 
       // $(".ajax-results-list").slideDown('slow'); 
       checkScroll();             
       $("#loading-or-more").replaceWith('<a id="loading-or-more" class="headline gradientBGRed morecategories" href="#items-ajax-mobile"><span>More items</span></a>'); } 

      } 
    }); 
} 

function nearBottomOfPage() { 
    return scrollDistanceFromBottom() < 400; 
} 

function scrollDistanceFromBottom(argument) { 
    return $(document).height() - ($(window).height() + $(window).scrollTop()); 
} 

function full_path(currentPage) { 
    return (path+"?page=" + currentPage+"&format=js") ; 
} 

$(document).ready(function() { 
    // checks if "MORE" exists, if so calls checkscroll 
    if ($("#loading-or-more").length) { checkScroll(); } 
    }); 
+0

어떤 오류가 발생합니까? 당신의 대답 수락을 향상시켜야합니다; '0 %'는 무례합니다! – charlietfl

+1

JS 콘솔에 오류가 있습니까? 그렇지 않다면 작동하지 않는 것은 무엇입니까? –

+0

미안하지만, 내 게시물에 넣어해야합니다. 이 사람과 관련된 오류는 없습니다. 이상하지, 그렇지? – jahrichie

답변

0

텍스트에 데이터 유형을 지정해야하며 데이터를 가져 오기 시작했습니다. 감사합니다. @ Ohgodwhy

dataType: "text", 
관련 문제