2012-12-19 3 views
5

"Whats Playing"정보 표시 줄이있는 jPlayer가 수정되었습니다.jQuery의 요소에 스크롤러를 연결하십시오.

정보 표시 줄에 PHP 파일의 정보가 표시됩니다.

나는 플레이어 막대의 정보에 스크롤러를 부착해야하지만 그럴 수는 없다.

스크롤러는 별도의 js 파일에 있습니다.

http://www.maxvergelli.com/jquery-scroller/

jQuery를 :

getCurrentTrack(); 

$('.now_playing').SetScroller({ 
    velocity: 50, 
    direction: 'horizontal', 
    startfrom: 'right', 
    loop: 'infinite', 
    movetype: 'linear', 
    onmouseover: 'pause', 
    onmouseout: 'play', 
    onstartup: 'play', 
    cursor: 'pointer' 
}); 

function getCurrentTrack() { 
    $('.now_playing').load('/player/readerPlayer2.php'); 
    setInterval(function() { 
     $('.now_playing').load('/player/readerPlayer2.php'); 
    }, 9000); 
};​ 

PHP의 정보 :

<?php 
header("Expires: Tue, 03 Jul 2040 06:00:00 GMT"); 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache"); 

$xml = simplexml_load_file("http://**.**.**.**:8000/live.xspf"); 

foreach ($xml->trackList->track as $data) { 
    $radio = $data->location; 
    $song = $data->title; 
    $info = $data->listeners; 
} 
echo '<div class="IceSong">'.$song.'</div>'; 
?> 

답변

1

는 브라우저 콘솔에서 출력을 찾고 시도?

나는 이것을 시험해 보았다.로드 uri에서 첫 번째 슬래시를 제거하면 제대로 작동하는 것처럼 보인다.

다시 호출하지 않고 setInterval에서 getCurrentTrack 함수를 다시 호출 할 수 있습니다.

function getCurrentTrack() { 
     $('.now_playing').load('player/readerPlayer2.php'); 
     setInterval(getCurrentTrack, 9000); 
    } 

또 다른 중요한 점은 함수 선언 다음에 세미콜론이 필요 없다는 것입니다. 자세한 내용은 Why should I use a semicolon after every function in javascript?

에 대한 답변을 참조하십시오. 도움이 되었으면 좋겠어. 어떻게 시작하는지 알 수 있습니다.

+0

답장을위한 Thanx. 나는 다른 하나에 스크립트를 수정했지만 스크롤러에 표시하는 정보를 얻을 수 없어 ... 스크롤러는 잘 작동하지만 .. -> http://stackoverflow.com/questions/13938174/draw-stats-from-php -file/13938552 # comment19220208_13938552 알고있는 경우이 해결책이 아직 없습니다. – TonalDev

관련 문제