Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <div class="media-item audio">
  2. <audio controls>
  3. <source src='http://example.com/wp-content/uploads/track.mp3' class="mp3" type="audio/mpeg">
  4. </audio>
  5. </div>
  6.  
  7. jQuery( function ($) {
  8.  
  9. $('.media-item.audio').on('click', function(e){
  10.  
  11. var audio = $(this).find('audio')[0];
  12. e.preventDefault();
  13.  
  14. if (audio.paused) {
  15. audio.play();
  16. } else {
  17. audio.pause();
  18. }
  19.  
  20. });
  21.  
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement