Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css">
- <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script>
- <script>
- $(document).on("pagecreate",function(event){
- $(window).on("orientationchange",function(event){
- document.getElementbyId("song").play();
- });
- });
- </script>
- </head>
- <body>
- <div id="drunk">
- <audio controls autoplay id="song">
- <source src="bdayDiddy.mp3" type="audio/mpeg">
- </audio></div>
- </body>
- </html>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.css">
- <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.4.4/jquery.mobile-1.4.4.min.js"></script>
- <script>
- $(document).ready(function(event){
- $(window).on("orientationchange",function(event){
- //initiate fake click to get around iOS 4+ autoplay ban
- function fakeClick(fn) {
- var $a = $('<a href="#" id="fakeClick"></a>');
- $a.bind("click", function(e) {
- e.preventDefault();
- fn();
- });
- $("body").append($a);
- var evt,
- el = $("#fakeClick").get(0);
- if (document.createEvent) {
- evt = document.createEvent("MouseEvents");
- if (evt.initMouseEvent) {
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- el.dispatchEvent(evt);
- }
- }
- $(el).remove();
- }
- $(function() { //should initiate auido in the div below?
- var audioo = $("#drunka").get(0);
- fakeClick(function() {
- audioo.play();
- });
- });
- });
- });
- </script>
- </head>
- <body>
- <div id="drunk">
- <audio controls autoplay id="drunka">
- <source src="bdayDiddy.mp3" type="audio/mpeg">
- </audio></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement