jquery code in drupal 7 module -
how dispaly following code in drupal 7 module
<script type="text/javascript" src="http://dubturbo1.counselstime.com/jwplayer/jwplayer.js"></script> <script>jwplayer.key="76oyax0savqgdm580aj3+k23kiun8hfkgahyrq=="</script> <div id="my-video"></div> <script type="text/javascript"> jwplayer('my-video').setup({ file: 'http://192.168.1.150/sathya/video_test_512kb.mp4', width: '500', height: '300', controls: 'false', autostart: 'true', }); </script>
you need add js file, either within module (if necessary) or otherwise put within themes js file if don't need module doing.
wrap in drupal behaviours wrapper:
(function($) { drupal.behaviors.setupvideo = { attach: function (context) { wplayer('my-video').setup({ file: 'http://192.168.1.150/sathya/video_test_512kb.mp4', width: '500', height: '300', controls: 'false', autostart: 'true' }); } }; })(jquery);
you need add first js file (the jwplayer stuff) in there too. add line in theme or add module:
drupal_add_js(drupal_get_path('module', 'my_module') . '/js/jwplayer.js', 'file');
Comments
Post a Comment