开发者

Why is this video not being embedded?

开发者 https://www.devze.com 2023-02-17 01:39 出处:网络
Here\'s my application.js file: $(document).ready(function() { $(\'a.oembed\').embedly({maxWidth:600,\'method\':\'replace\'});

Here's my application.js file:

$(document).ready(function() {
$('a.oembed').embedly({maxWidth:600,'method':'replace'});
});

Here's my show view:

<div id="video_div"><%= link_to 'video', @video.video_url, :class => 'oembed' %></div>

The result is simply the link to the youtube video with the text "video". The video is not being embedded.

I input the link in my new view and save @video.video_url to the db.

I successfully include these files:

<script src="/javascripts/jquery.embedly.js?1299981574" type="text/javascript"></script> 
<script src="/javascripts/jquery-1.4.2.min.js?1299978321" type="text/javascript"></script> 
<script src="/javascripts/rails.js?12开发者_开发知识库99978356" type="text/javascript"></script> 
<script src="/javascripts/application.js?1300064036" type="text/javascript"></script> 


Try reordering the includes so that embedly is included after jquery. If you look at the javascript console in inspector/firebug you'll probably see that embedly can't find the jQuery variable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号