ajhanna88 Posted March 27, 2014 Share Posted March 27, 2014 Hi guys, I am trying to use a function that accepts two parameters the name (id of the div) and the video file path (filename) to avoid duplicating code 5 times for each video which does the exact same thing, however it is not loading the video. I have checked my error console on firebug and I am receiving no errors on the page, is what I am trying to achieve possible, or am I calling the code in the wrong place? Thanks <script> $(document).ready(function(){ playVideo('video_01', '/video/video1.mp4'); playVideo('video_02', '/video/video2.mp4'); playVideo('video_03', '/video/video3.mp4'); playVideo('video_04', '/video/video4.mp4'); playVideo('video_05', '/video/video5.mp4'); function playVideo(name, filename) { jwplayer(name).setup({ file: filename, controls: true, width: 680, height: 498, autostart: false, //repeat: "always", stretching:"fill", backcolor: 'FFFFFF', smoothing: 'false', startparam: 0, events: { onPause: function(event) { jwplayer(name).play(); }, onSeek: function(event) { jwplayer(name).play(); } } }); $(window).resize(function(){ var vidsizes = getEraVidSizes(); jwplayer().resize(vidsizes.width,vidsizes.height); }); } }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/287317-javascript-function-not-working/ Share on other sites More sharing options...
john_c_1984 Posted April 6, 2014 Share Posted April 6, 2014 Technically you are calling an undefined function, then declaring the function. Try declaring the funciton first then calling it? Quote Link to comment https://forums.phpfreaks.com/topic/287317-javascript-function-not-working/#findComment-1475123 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.