hey all i am have implement pretty photo in some video website and it works like a charm. The problem开发者_JAVA百科 is i am trying to implement a timer that help me with tracing video times and how much time the user have seen.It works fine with any other page but i dont know where to put it in pretty photo and this is the code i implement: please help
i am using zend-framework and this is what is in the view of the video:
<?php if ($this->hasid) {
?>
<script type='text/javascript'>
var timerinterval
jwplayer('player2').onPlay(function() {
timerinterval=setInterval('timer()',1000)});
jwplayer('player2').onPause(function() {
stopTimer()});
jwplayer('player2').onComplete(function(){
stopTimer()});
</script>
<?php } ?>
and this is the ajax:
var time=0
function timer(){
time++;
if(time%60==0)
{
$.post('/video/time/',{
time:time,
videoid:$('#videoid').val()
},function(data){
});
}
$('#timer').html(time);
}
function stopTimer()
{
clearInterval(timerinterval);
}
The short answer is that what you've posted as your sample.. isn't AJAX. Are you suggesting that is your javascript include?
If so, you'll need to post a bit more code. The javascript itself is fine. If you've got an issue, it is likely that 'jwplayer('player2')' is referencing an ID. You'll need to ensure that you're using the same ID as prettyPhoto. If you're using a template.. that will break the ID scheme, because IDs must be unique in a page.
精彩评论