Avtar Brar
Avtar Brar

Reputation: 93

HTML 5 Lightbox to open on entry

iv downloaded a HTML 5 Lightbox from here: http://html5box.com/products.php to display a video within it. Im happy with the player but is a necessity for the player to open upon entry of the site instead of clicking the 'bg.jpg' picture (which it is at the moment).

The main html page code is here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>NBC Uni</title>

<script type="text/javascript" src="html5lightbox/jquery.js"></script>
<script type="text/javascript" src="html5lightbox/html5lightbox.js"></script>


</head>

<body>
<div align="center"><a href="video.mp4" class="html5lightbox"  data-width="720" data-height="404" ><img src="bg.jpg" width="1023" height="820" /></a></div>
</body>
</html>

any help is much appreciated! thanks

Upvotes: 0

Views: 1443

Answers (2)

superUntitled
superUntitled

Reputation: 22527

This should work.

$(document).ready(function() {
  $('.html5lightbox').trigger('click');
})

Upvotes: 1

Pablo Martinez
Pablo Martinez

Reputation: 2182

You can simulate the click on the img with jquery:

$(document).ready(function(){

    $("#imgvideo").click();

});

You have to put the id="imgvideo" to the image

Upvotes: 3

Related Questions