为什么我的叠加层 jquery 代码会出现此错误?
这是代码:
jQuery(document).ready(function($) {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
mask: 'darkred',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getOverlay().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
此代码是这样的叠加层:http://flowplayer.org/tools/demos/overlay/external.html
暂停?
附言。抱歉我的英语不好。
最佳答案
“Could not find Overlay: nofollow”是由于使用非特定的 css 选择器来查找您要将叠加层附加到的链接造成的。
正确包含 javascript 是对初始问题的正确答案...我是基于评论中的 Overlay: nofollow 问题来到此页面....因为这是我发现和没有找到的第一件事一个我想在这里评论的答案,因为我发现它是由 css 选择器发现 .. 的其他用途引起的,并且没有 nofollow 覆盖...
假设 'overlay' 是您的 div 的 id,如下所示:
<!-- overlayed element -->
<div class="apple_overlay" id="overlay">
< !-- the external content is loaded inside this tag -- >
<div class="contentWrap"></div>
</div>
你应该这样做:
$("a[rel=#overlay]").overlay(
代替:
$("a[rel]").overlay(
关于javascript - 未捕获的类型错误 : Object [object Object] has no method 'overlay' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8547138/