, 나는 그 반대로 JQuery와의 조합은 HTML과 미디어를 통합하려는 아무것도 Popcorn.js 등을 추천합니다. 예를 들어 jsfiddle post을 참조하십시오.
기록을 위해
, 지금까지 jsfiddle 사라, 여기에 코드입니다 :
HTML
<audio id="greeting" src="https://dl.dropboxusercontent.com/u/17154625/greeting.ogg" controls></audio>
<div id="text">
<span id="w1" class="word" data-start="1.0">Hello</span>,
and <span id="w2" class="word" data-start="2.0">welcome</span>
to Stack <span id="w3" class="word" data-start="3.0">Overflow</span>.
Thank you for asking your question.
</div>
CSS
.word {
color: red;
}
.word:hover, .word.selected {
color: blue;
cursor: pointer;
}
JS
var pop = Popcorn("#greeting");
var wordTimes = {
"w1": { start: 1, end: 1.5 },
"w2": { start: 1.9, end: 2.5 },
"w3": { start: 3, end: 4 }
};
$.each(wordTimes, function(id, time) {
pop.footnote({
start: time.start,
end: time.end,
text: '',
target: id,
effect: "applyclass",
applyclass: "selected"
});
});
pop.play();
$('.word').click(function() {
var audio = $('#greeting');
audio[0].currentTime = parseFloat($(this).data('start'), 10);
audio[0].play();
});
슈퍼 - 대단히 감사합니다 ! 나는 이것으로 내 손을 충분히 노리도록하겠다 ... 내가 후속 조치가 필요하다면 나를 기쁘게 할 수 있기를 바란다. 건배! – shecky
p.s. jsfiddle 데모에서 목소리를 내기 위해 무엇을 사용 했습니까? – shecky
내 Mac에서 '안녕하세요'라고 말하여 스택 오버 플로우를 환영합니다. 질문 해 주셔서 감사합니다. " - 인사말 .ogg' – thisgeek