两个jquery脚本冲突
我在向我的网站添加灯箱脚本时遇到了麻烦,这是因为我正在使用本教程中的代码 http://tutorialzine.com/2010/11/apple-style-splash-screen-jquery/ 在我的网站的开头,因此它会在进入时加载动画该网站,但是 `
$(document).ready(function(){
// Calling our splashScreen plugin and
// passing an array with images to be shown
$('#promoIMG').splashScreen({
textLayers : [
'img/thinner.png',
'img/more_elegant.png',
'img/our_new.png'
]
});
});
上面的代码取消了我从此处找到的灯箱脚本中使用的任何内容: http:// /leandrovieira.com/projects/jquery/lightbox/#
如何让两者协同工作?
我将它们添加到我的标题中,如下所示(它在 WordPress 中):
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="shortcut icon" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.ico" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/jquery.splashscreen.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/script.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/lightbox/js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/Javascript/lightbox/css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
$(function() {
$('#sidebar-menu a').lightBox();
});
</script>
任何建议都可以!
I'm having truble adding a lightbox script to my site, it's because i'm using the code from this tutorial http://tutorialzine.com/2010/11/apple-style-splash-screen-jquery/ at the start of my site, so it loads an animation upon entering the site, however `
$(document).ready(function(){
// Calling our splashScreen plugin and
// passing an array with images to be shown
$('#promoIMG').splashScreen({
textLayers : [
'img/thinner.png',
'img/more_elegant.png',
'img/our_new.png'
]
});
});
The above code cancels out anything i use from the lightbox script found here: http://leandrovieira.com/projects/jquery/lightbox/#
How do I get the two to work together?
I'm adding them to my header as follows (it's within wordpress):
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="shortcut icon" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.ico" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/jquery.splashscreen.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/script.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/Javascript/lightbox/js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/Javascript/lightbox/css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
$(function() {
$('#sidebar-menu a').lightBox();
});
</script>
Any suggestions will do!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该向启动屏幕插件添加一个回调,以在完成后初始化灯箱。
回调应该在关闭spash的点击事件上执行
,然后在创建对象时传递回调
编辑添加
condole.log
以查看实际到达的代码。you should add a callback to the splash screen plugin to initialize lightbox once it's finished.
the callback should be executed on the click event which closes the spash
then pass the callback when creating the object
EDIT add the
condole.log
's to see what code actually gets reached.