触发脚本VIA URL [英] Triggering Script VIA URL
本文介绍了触发脚本VIA URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果URL为site.com/page.html?globe=1,我有一个脚本调用灯箱来触发,它的代码如下:
I have this script calling a lightbox to trigger if the URL is site.com/page.html?globe=1 and it is not working here is the code:
var $j = jQuery.noConflict();
$j(document).ready(function() {
var url = window.location.href;
url = url.toLowerCase();
if (url.indexOf('globe=1') != -1) {
$j("a#fancy").fancybox({
'padding' : 0,
'overlayShow' : false,
});
}
}
});
$j("a#fancy").fancybox({
'padding' : 0,
'overlayShow' : false,
});
出什么问题了,为什么不起作用?之前,我已将此代码用于除fancybox之外的其他脚本,并且我认为输入的代码有误.
What is wrong and why does it not work? I have used this before for other scripts other than fancybox and I assume I am typing some code wrong.
推荐答案
var $j = jQuery.noConflict();
$j(document).ready(function() {
var url = window.location.href;
url = url.toLowerCase();
if (url.indexOf('globe=1') != -1) {
$j("a#fancy").fancybox({
'padding': 0,
'overlayShow': false // extra comma removed
});
}
}); // extra curly bracket removed
$j("a#fancy").fancybox({
'padding': 0,
'overlayShow': false // extra comma removed
});
几乎没有错误-一个括号和两个逗号.使用可视IDE跟踪括号.
There were few errors - a bracket, and 2 commas. Use visual IDE to track the brackets.
这篇关于触发脚本VIA URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文