2 个 jquery 脚本单独工作正常...但是当在同一页面上时都不起作用
你好,我有 2 个脚本,1 是精美的弹出框内联文本,另一个是 nivo 图像滑块,它们本身都很好用,但是当在页面头部运行它们时都不起作用,有什么想法吗?这是两个脚本
$(document).ready(function() {
$("#various1").fancybox();
});
和滑块......
$(window).load(function() {
$('#slider').nivoSlider({
effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
directionNavHide:false, // Only show on hover
pauseOnHover:true, // Stop animation while hovering
manualAdvance:true, // Force manual transitions
});
});
Hi ive got 2 scripts 1 is fancy box popup inline peice of text and the other is a nivo image slider, they both work great by them selves but when but in the head of the page to run them neither work, any ideas ? heres the two scripts
$(document).ready(function() {
$("#various1").fancybox();
});
and the slider...
$(window).load(function() {
$('#slider').nivoSlider({
effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
directionNavHide:false, // Only show on hover
pauseOnHover:true, // Stop animation while hovering
manualAdvance:true, // Force manual transitions
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为第二个脚本存在语法错误。
这应该有效。
另外,我删除了最后一个逗号,因为没有列出更多内容,并且该逗号可能会在某些浏览器上引起问题。
Because there is a syntax error on the second script.
This should work.
Also, I removed the last comma, as there are no more things listed and that comma may cause problems on some browsers.
如果你搜索这个问题,你会发现很多人都有同样的问题。这两个工具都是 jQuery 插件,因此它们可能有一些冲突的代码。
如果您无法修复插件内的错误,您可能需要替换其中一个插件,例如使用 nivoo slider< /a>,nivo 从 jQuery 到 Mootools 的端口。
If you search for that problem you'll find plenty of people with the same problem. Both tools are jQuery plugins so probably they have some conflicting code.
If you can't fix the error inside the plugins you might want to substitute one of them, e.g. using nivoo slider, a port of nivo from jQuery to Mootools.