JQuery Video Trigger Problem

JQuery Video Trigger Problem

Hello All you Smiling Faces (and computer nerds in dark closets),

This is my first post on the forum as I am very new to JQuery. 

I'm attempting to use it to trigger a video to play and after it finishes, remove the video and direct a user to a specific website. 

The code more-or-less works but the duration of the video is random, sometimes it plays all the way, others it goes directly to the website, or sometimes the video starts playing without clicking a flag. 

If someone could help me out, that would be totally excellent.

Please mind that I have no knowledge of Jquery so I'm sure there are many better ways to do this so any suggestions would be appreciated.


Here's the code:

  1. <!doctype php>
  2. <php>

  3. <head>
  4.   <meta charset="utf-8">
  5.   <title>Porta Batumi Tower</title>
  6. <link href='http://fonts.googleapis.com/css?family=Merriweather' rel='stylesheet' type='text/css'>
  7. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  8. <link rel="stylesheet" href="../widescreen-child/style.css" type="text/css" />

  9. <script type="text/javascript">
  10.     
  11.    $(function(){
  12.        $(document).delegate('#play','click',function(){
  13.           $('#zoom')[0].play(); 
  14.            $("body").delay(6000).fadeOut(1000);
  15.             window.location = "/home-georgian/";
  16.        });
  17.    });
  18.    
  19.       $(function(){
  20.        $(document).delegate('#play2','click',function(){
  21.           $('#zoom')[0].play(); 
  22.            $("body").delay(6000).fadeOut(1000);
  23.             window.location = "/home/";
  24.        });
  25.    });
  26.      
  27.       $(function(){
  28.        $(document).delegate('#play3','click',function(){
  29.           $('#zoom')[0].play(); 
  30.            $("body").delay(6000).fadeOut(1000);
  31.             window.location = "/home-russian/";
  32.        });
  33.    });
  34.     
  35. </script>

  36. </head>

  37. <body style="background-color:white !important;">

  38. <div id="language_portal">

  39. <div id="logo">
  40. <img src="images/portabatumi_logo.jpg">
  41. </div>

  42. <h1>THE JEWEL OF <br/>
  43. NEW BATUMI</h1>
  44. <a href="javascript:void(0)" id="play" ><img src="images/flag_georgian.gif"></a>
  45. <a href="javascript:void(0)" id="play2" ><img src="images/flag_american.gif"></a>
  46. <a href="javascript:void(0)" id="play3" ><img src="images/flag_russia.gif"></a>
  47. </div>

  48. <div class="embed-container">
  49. <video  id="zoom" preload src="http://www.portabatumitower.com/wp-content/themes/widescreen/images/portabatumi_zoom3.mp4" ></video>
  50. </div>

  51. </body>
  52. </php>

Thanks and hare krishna,
Ross