使用自己的 Jquery Oembed 处理程序
我正在尝试使用我自己的函数(从来不喜欢 $(document).ready()
)从 URL 动态加载嵌入。
我正在尝试这样:
function video(donde,url) {
$("#"+donde).oembed(url);
return false;
}
一个使用示例是:
<div class="texto">
[my title]
<span style="float: right;">
<img onclick="video('video68084','http://www.youtube.com/watch?v=ORZTCQjAuZY');" src="http://i1.ytimg.com/vi/ORZTCQjAuZY/default.jpg" alt="preview" onerror="this.src='images/linket.png';" class="caja_con_sombra" style="width: 80px; height: 60px;"> </span>
<div style="float: left; width: 76%;">
[my description]
</div>
<div id="video68084"></div>
</div>
Which Jumps:
b.type is not a function
[Interrumpir en este error] b.ready);var j=false;try{j=E.frameElem...ow(j))return false;if(j.constructor&&
Onclick vía firebug :(
知道我错过了什么吗?错误源文件是 jquery.min.js :S
I'm trying to use my own function (never liked $(document).ready()
) to dynamically load an embed from an URL.
I'm trying like this:
function video(donde,url) {
$("#"+donde).oembed(url);
return false;
}
And an example of use would be:
<div class="texto">
[my title]
<span style="float: right;">
<img onclick="video('video68084','http://www.youtube.com/watch?v=ORZTCQjAuZY');" src="http://i1.ytimg.com/vi/ORZTCQjAuZY/default.jpg" alt="preview" onerror="this.src='images/linket.png';" class="caja_con_sombra" style="width: 80px; height: 60px;"> </span>
<div style="float: left; width: 76%;">
[my description]
</div>
<div id="video68084"></div>
</div>
Which jumps:
b.type is not a function
[Interrumpir en este error] b.ready);var j=false;try{j=E.frameElem...ow(j))return false;if(j.constructor&&
Onclick vía firebug :(
Any idea what I'm missing? The error source file is jquery.min.js :S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你没有遗漏任何东西,你在 oembed 插件中发现了一个错误。不错的发现,也许你在质量保证方面有一个未来的职业生涯:)
看起来 oembed 和 jQuery 都想使用
.type
但 jQuery 最终以 oembed 的字符串.type
结尾,其中它需要自己的函数.type
。oembed 插件 在 jQuery-1.3.2 上运行良好,但从 jQuery-1.4 开始就出现问题.3.
您可以从此 jsfiddle 中提取 oembed 插件的功能版本: http://jsfiddle.net/ambigously/ ZVhUn/1/
此问题已报告过多次但 oembed 作者似乎并没有在听。如果您需要的话,这是该插件的固定版本:
唯一的变化是我将
var oembed = $.extend(data);
替换为var oembed = $.extend({ }, data);
在文件底部的this.embedCode
中。You're not missing anything, you found a bug in the oembed plugin. Nice find, maybe you have a future career in quality assurance :)
Looks like both oembed and jQuery want to use
.type
but jQuery is ending up with oembed's string.type
where it wants its own function.type
.The oembed plugin works fine with jQuery-1.3.2 but breaks as of jQuery-1.4.3.
You can pull a functional version of the oembed plugin from this jsfiddle: http://jsfiddle.net/ambiguous/ZVhUn/1/
This problem has been reported several times but the oembed author doesn't seem to be listening. Here's a fixed version of the plugin if you want it:
The only change is that I replaced
var oembed = $.extend(data);
withvar oembed = $.extend({ }, data);
inthis.embedCode
at the bottom of the file.