jquery 与 videobox 和自定义代码冲突
好的,我有一个页面使用 3 个插件和自定义代码。
我的自定义代码只是更改菜单中项目的 css 样式(我也会发布该代码)。
我的问题是 Fullscreenr 和 ScrollTo 工作正常,但是当我想添加 VideoBox 时,视频弹出窗口不想工作,它所做的只是重定向到 YouTube 页面。当我检查页面(Chrome)时,它显示此错误:
Uncaught TypeError: Object #<Object> has no method 'setProperty'
在这一行:
this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body);
我尝试使用 $.noConflict();现在,如果我删除了所有其他插件,那么它就可以工作,但这对我来说不起作用,因为我需要一切都可以工作。希望有人知道我能做些什么来解决这个问题。
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/videobox.js"></script>
<!-- IF I REMOVE FROM HERE DOWN VIDEOBOX WORKS -->
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.fullscreenr.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// You need to specify the size of your background image here (could be done automatically by some PHP code)
var FullscreenrOptions = { width: 1024, height: 439, bgID: '#bgimg' };
// This will activate the full screen background!
jQuery.fn.fullscreenr(FullscreenrOptions);
//-->
</script>
<script type='text/javascript' src='js/jquery.min.js'></script>
<script type='text/javascript' src='js/jquery.scrollTo-min.js'></script>
<script type='text/javascript' src='js/init.js'></script>
<script language="javascript">
function GotoSection(divid)
{
$('#realBody').scrollTo( '#' + divid, 800, {duration:3000} );
switch(divid)
{
case "home":
$("#mhome").attr('class', 'selected');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "vids":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'selected');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "eventos":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'selected');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "fotos":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'selected');
$("#mcontact").attr('class', 'non');
break;
case "contact":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'selected');
break;
}
}
</script>
如果有更好的脚本我可以使用,我也欢迎任何和所有建议。
Ok I have a page that uses 3 plugins and custom code.
my custom code is just to change css style of items in menu(I'll post that code aswell).
My issue is that Fullscreenr and ScrollTo were working fine but when I want to add VideoBox the video popup doesn't want to work all it does is redirect to the youtube page. When I inspect the page(Chrome) it shows this error:
Uncaught TypeError: Object #<Object> has no method 'setProperty'
on this line:
this.overlay = new Element('div').setProperty('id', 'lbOverlay').injectInside(document.body);
I have tried using $.noConflict(); Now if I removed all the other plugins then it works but that doesn't work for me cause I need everything to work. Well hope somebody knows what I can do to fix this.
<script type="text/javascript" src="js/mootools.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/videobox.js"></script>
<!-- IF I REMOVE FROM HERE DOWN VIDEOBOX WORKS -->
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.fullscreenr.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
// You need to specify the size of your background image here (could be done automatically by some PHP code)
var FullscreenrOptions = { width: 1024, height: 439, bgID: '#bgimg' };
// This will activate the full screen background!
jQuery.fn.fullscreenr(FullscreenrOptions);
//-->
</script>
<script type='text/javascript' src='js/jquery.min.js'></script>
<script type='text/javascript' src='js/jquery.scrollTo-min.js'></script>
<script type='text/javascript' src='js/init.js'></script>
<script language="javascript">
function GotoSection(divid)
{
$('#realBody').scrollTo( '#' + divid, 800, {duration:3000} );
switch(divid)
{
case "home":
$("#mhome").attr('class', 'selected');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "vids":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'selected');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "eventos":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'selected');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'non');
break;
case "fotos":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'selected');
$("#mcontact").attr('class', 'non');
break;
case "contact":
$("#mhome").attr('class', 'non');
$("#mvids").attr('class', 'non');
$("#meventos").attr('class', 'non');
$("#mfotos").attr('class', 'non');
$("#mcontact").attr('class', 'selected');
break;
}
}
</script>
If there is a better script I can use I welcome any and all suggestions aswell.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果多个库在网页中使用相同的 $,这将起作用。
我们在这里定义了一个匿名函数,它将 jQuery 作为唯一的参数。它在上面的函数中映射到 $ 并且您的代码将按预期工作。你完全可以做这样的事情。
This will work if multiple libraries use the same $ in a webpage.
We define an anonymous function here, which takes jQuery as its only argument. It gets mapped to $ in the above function and your code will work just as expected. You can very well do things like this.
您必须使用 noConflict,因为您也在使用 mootools
You must use noConflict as you are also using mootools