简体   繁体   English

jQuery 在本地主机上工作,但在直播时不工作?

[英]jQuery working in localhost but not when live?

I'm using the following code to animated a title in my slideshow.我正在使用以下代码为幻灯片中的标题设置动画。 It is working fine in my localhost but as soon as I upload it to live it doesn't seem to be working.它在我的本地主机中运行良好,但是一旦我将其上传到现场,它似乎就无法正常工作。

All my files are linked properly I just can't see why this would be happening.我所有的文件都正确链接,我只是不明白为什么会发生这种情况。

I wondered if anyone could see anything wrong with the code or may have a reason why this might be.我想知道是否有人可以看到代码有任何问题,或者可能有原因。

$(window).load(function () {

doIt();

function doIt(){
    $('#title1').fadeIn('fast', function() {
    $('#title1').addClass('animated title-pop');
})
$('#title1').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend 
animationend', function() {
$('#title1').delay(8200).fadeOut(2000, function() {doIt();});
});
};

doItTwo();

function doItTwo(){
    $('#title2').fadeIn('fast', function() {
    $('#title2').addClass('animated title-pop');
})
$('#title2').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend 
animationend', function() {
$('#title2').delay(8200).fadeOut(2000, function() {doItTwo();});
});
};

});

确保您的实时服务器上的 jQuery 文件的路径正确。

I had a similar issue.我有一个类似的问题。 I checked the web developer console (Firebug on Firefox) and found there was a JavaScript error.我检查了 Web 开发人员控制台(Firefox 上的 Firebug),发现存在 JavaScript 错误。 The path to jQuery was set as http while my website is https , so the jQuery wasn't loading correctly. jQuery 的路径设置为http而我的网站是https ,所以 jQuery 没有正确加载。

After I set http to https , the script loaded perfectly.http设置为https ,脚本完美加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM