开发者

Audio player object appending using jquery problem

I'm with a problem embedding one audio object in two different divs. The javascript only appends the object on the first called div, lefting the other one empty. How can i append the same object in two different divs?

I'm working on a web app project and those divs represents the orientation of the device. When i turn on a side, the other div hides (e.g 开发者_StackOverflowI'm in portrait view - landscape div hides).

Here's my code:

var audioPlayer = new Audio();


audioPlayerPort.controls="controls";
audioPlayerPort.setAttribute('src','mysource');

$('#playerAudioLandscape').append(audioPlayer);
$('#playerAudioPortrait').append(audioPlayer);


Think about it; how can one element exist in two places at once? What you should do is make a copy and insert one in each element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜