简体   繁体   中英

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. The path to jQuery was set as http while my website is https , so the jQuery wasn't loading correctly.

After I set http to https , the script loaded perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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