This is how I usually start a video file with fancybox and jwplayer.
Head:
<head> /* ... */
<script type="text/javascript" src="jwplayer/jwplayer.js"></script>
<script type="text/javascript" src="fancybox/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="fancybox/source/jquery.fancybox.js?v=2.1.3"></script>
<link rel="stylesheet" type="text/css" href="fancybox/source/jquery.fancybox.css?v=2.1.3" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
</script>
<script type="text/javascript">
$(document).ready(function() {
jwplayer('startTheMovie').setup({
file: "file.mp4",
width: "640",
height: "360",
});
});
</script>
</head>
Body:
<body>
<div style="display:none">
<div id="movie">
<div id="startTheMovie">Loading...</div>
</div>
</div>
<a href="#movie" class="fancybox">Click here to start the movie</a>
</body>
The challenge now is: I have 140 video files and don't want a function for every single file. Do you know a solution for giving a video id (which may be the filename of a video file) to the function when clicking on a link?
I thought about something like this:
<a href="#movie?id=movie1" class="fancybox">Click here to start movie no 1</a>
<a href="#movie?id=movie2" class="fancybox">Click here to start movie no 2</a>
Thank you.