Question

I am using iFrame to display video on www.ridesharebuddy.com. I am using autoplay feature in this.

I am doing it this way.

<iframe src="//player.vimeo.com/video/82633004?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

But sometimes it starts even before the whole page is loaded. Can i give some delay in this to load video after 5-10 seconds?

Était-ce utile?

La solution

You can append the video link after the page is loaded via jQuery.

<iframe id="vimeo_frame" src="#" width="500" height="320" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

<script>
jQuery(window).load(function()
{
    var vimeo_frame = jQuery('#vimeo_frame'),
        vimeo_src = 'player.vimeo.com/video/82633004?title=0&amp;byline=0&amp;portrait=0&amp;autoplay=1';

    setTimeout(function()
    {
        vimeo_frame.attr('src', vimeo_src);
    }, 2000);
}
</script>

Don't forget to include jQuery ;-)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top