i'm using code fadein youtube video #vid div when user clicks on button , automatically play well. works in browsers, reason when try clicking on button in opera 10.5 nothing happens. idea wrong , how fix it, please?
javascript:
// create youtube player var player; function onyoutubeplayerapiready() { player = new yt.player('vid', { height: '539', width: '958', videoid: 'cz0jorye0ju', events: { 'onstatechange': onplayerstatechange } }); } // when video ends function onplayerstatechange(event) { if(event.data === 0) { $("#vid").fadeout(500); } } function startvideo() { $("#vid").fadein(2000); player.playvideo(); $("html, body").animate({ scrolltop: 160 }, 600); return false; }; html:
<a href="javascript:startvideo();" class="eshop index" style="width:319px; left:320px; border-right:1px solid white;">prehrať ukážku</a> thanks lot.
i don't know sure if work, instead of using javascript in href, why not add class i.e.
<a class="startvideo eshop index" style="width:319px; left:320px; border-right:1px solid white;">prehrať ukážku</a> ad bind startvideo() function click event on that.
$('.startvideo').click(function() { startvideo(); }); like say, i'm not sure if work, it's worth shot. other thing test see if startvideo isn't firing sure. stick alert('hiya') @ beginning of startvideo() function , click button check tat it's getting far.
hope helps. luck.
Comments
Post a Comment