2010-07-08 1 views
-3

아래의 URL과 정확히 일치하는 항목이 필요합니다.수량이 증가하면 PHP를 사용하여 진행률 표시 줄을 늘려야합니다.

URL : http://www.buywithme.com/

구매의 어떤 단계에 의해 단계를 이동합니다 진행 표시 줄을 증가시킨다.

이 기능을 사용하여 정확하게 구현해야합니다.

어떤 아이디어 나 샘플 코드를 알려주는 것이 좋습니다. 사전

+1

PHP가이 용도로 적합한 도구입니까? –

답변

0

에서

덕분에 당신은 실제로는 정확해야하는 경우, 당신은 가장 가능성, 그것을 클라이언트 측을 그릴해야합니다. PHP 스크립트는 진행률 막대의 위치를 ​​설명하는 JSON 객체를 반환 한 다음 스크립트에서 그 객체를 그립니다. Which JavaScript graphics library has the best performance?

0

PHP 당신은 자주 그 작은 부분을 다시로드 jQuery를 사용한다

$purchased_num = 13; // items purchased until now (example) 

$max_width = 400; // the width of the bar 
$max_pur = 50; // the maximum number of items 
$one_pur_width = round($max_width/$max_pur); 

$width = $one_pur_width * $purchased_num; 

// print the div with this width 
// and style the bar with css 
// ... 

1

: 여기에 몇 가지 자바 스크립트 그래픽 옵션을 나열 SO에서 다른 질문입니다. 페이지가로드 될 때

<div id="progBar"> 
</div> 

<script type=text/javascript> 
function refreshProgress() { 
    $.get('/folder/progbar.php', function (data) { 
     $('#progBar').html(data); 
    } 
    setTimeout('refreshProgress();',10000); 
} 

$(function() { refreshProgress(); }); 
</script> 

이 progbar.php로드 사업부로 (당시 매출액 기준 현재 진행 표시 줄을 생성하는), 그리고 10 초마다 새로 고침.

관련 문제